-
Notifications
You must be signed in to change notification settings - Fork 19
73 lines (61 loc) · 2.13 KB
/
release.yml
File metadata and controls
73 lines (61 loc) · 2.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
name: Release
on:
pull_request:
types: [closed]
branches:
- master
- main
permissions:
contents: write
jobs:
Release:
name: 🚀 Release
if: github.event.pull_request.merged && startsWith(github.head_ref, 'release-')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/github-script@v5
with:
script: |
// Getting the release version from the PR source branch
// Source branch looks like this: release-1.0.0
const version = context.payload.pull_request.head.ref.split('-')[1]
core.exportVariable('VERSION', version)
const get_change_log_diff = require('./scripts/get_changelog_diff.js')
const fs = require('fs');
fs.writeFileSync("latest_changes.txt", get_change_log_diff());
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: '1.22'
- run: |
git tag "${{ env.VERSION }}"
git push --tags
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@v2
with:
distribution: goreleaser
version: latest
args: release --clean --release-notes latest_changes.txt
env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
GORELEASER_CURRENT_TAG: ${{ env.VERSION }}
- name: Update docs
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Update local state, since goreleaser pushes into master
git pull
git config --global user.name 'GitHub Bot'
git config --global user.email 'cicd@getstream.io'
git checkout -q -b "docs-${{ env.VERSION }}"
# Generate new Markdown docs
rm -rf ./docs/stream-cli*.md
go run ./cmd/gen-docs --output ./docs
git add ./docs
git commit -m "docs(${{ env.VERSION }}): update markdown docs"
git push -q -u origin "docs-${{ env.VERSION }}"
# Push to docs branch
gh pr create --fill -t "docs(${{ env.VERSION }}): update markdown docs"