-
Notifications
You must be signed in to change notification settings - Fork 14
124 lines (105 loc) · 3.47 KB
/
finish-release-train.yml
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
name: Finish Release Train
on:
pull_request:
types:
- closed
branches:
- main
env:
LC_ALL: en_US.UTF-8
LANG: en_US.UTF-8
concurrency:
group: finish-release-train-${{ github.ref_name }}
cancel-in-progress: true
jobs:
prepare:
if: github.event.pull_request.merged == true && startsWith(github.head_ref, 'release/v')
runs-on: ubuntu-latest
outputs:
version_number: ${{ steps.version_number.outputs.version_number }}
steps:
- uses: actions/checkout@v4
with:
ssh-key: ${{ secrets.RELEASE_DEPLOY_KEY }}
- name: Setup Git User
run: |
# setup git
git config --global user.name "Bitmovin Release Automation"
git config --global user.email "[email protected]"
- name: Detect version number
id: version_number
run: |
version_number="$(jq --raw-output '.version' package.json)"
echo "Detected version number: $version_number"
echo "version_number=$version_number" >> $GITHUB_OUTPUT
- name: Update Changelog
run: |
sed -i "s/\[${{ steps.version_number.outputs.version_number }}\].*/\[${{ steps.version_number.outputs.version_number }}\] \($(date +'%Y-%m-%d')\)/g" CHANGELOG.md
- name: Commit changelog version bump
run: |
git add CHANGELOG.md
git commit -m "chore: bump changelog date to today"
git push origin ${{ github.ref }}
create_pr:
needs: [prepare]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Create PR
run: |
gh pr create \
--base "development" \
--head "main" \
--title "Finish release ${{ needs.prepare.outputs.version_number }}" \
--body "Finish release ${{ needs.prepare.outputs.version_number }}"
env:
GH_TOKEN: ${{ github.token }}
publish_release:
needs: [prepare, create_pr]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.ref_name }}
- name: Setup Git User
run: |
# setup git
git config --global user.name "Bitmovin Release Automation"
git config --global user.email "[email protected]"
- name: Add tag
run: |
git tag v${{ needs.prepare.outputs.version_number }}
- name: Git push
run: |
git push origin v${{ needs.prepare.outputs.version_number }}
- name: Setup Environment
uses: ./.github/actions/setup-environment
with:
node: true
- name: Build TypeScript files
run: yarn build
- name: Publish npm package
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Extract changelog
id: changelog
uses: ffurrer2/extract-release-notes@v1
- name: Create GitHub release
uses: ncipollo/release-action@v1
with:
tag: v${{ needs.prepare.outputs.version_number }}
token: ${{ secrets.GITHUB_TOKEN }}
body: ${{ steps.changelog.outputs.release_notes }}
publish_documentation:
needs: [publish_release]
name: Generate API Documentation
uses: ./.github/workflows/generate-documentation.yml
secrets:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
GCS_ACCOUNT: ${{ secrets.GCS_ACCOUNT }}
CF_TOKEN: ${{ secrets.CF_TOKEN }}
CF_ZONEID: ${{ secrets.CF_ZONEID }}