-
Notifications
You must be signed in to change notification settings - Fork 1
59 lines (58 loc) · 1.72 KB
/
release.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
name: release
on:
workflow_dispatch:
inputs:
version:
required: false
description: 'Next version ( NOTE: Switch the branch to "release"!)'
type: choice
default: minor
options:
- patch
- minor
- major
jobs:
release:
name: Release
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/release'
steps:
- uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ vars.GH_APP_ID }}
private-key: ${{ secrets.GH_APP_PRIVATE_KEY }}
- name: git config
env:
GH_APP_USER: ${{ vars.GH_APP_USER }}
run: |
git config --global user.name $GH_APP_USER
git config --global pull.rebase false
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ steps.app-token.outputs.token }}
- id: changelog
name: Generate CHANGELOG
uses: reearth/changelog-action@main
with:
version: ${{ github.event.inputs.version }}
repo: ${{ github.repository }}
latest: CHANGELOG_latest.md
- name: Upload latest CHANGELOG
uses: actions/upload-artifact@v3
with:
name: changelog-${{ steps.changelog.outputs.version }}
path: CHANGELOG_latest.md
- name: Commit & push to release
env:
TAG: ${{ steps.changelog.outputs.version }}
run: |
rm CHANGELOG_latest.md
git add CHANGELOG.md
git commit -am "$TAG"
git tag $TAG
git push --atomic origin release $TAG
- name: Commit & push to main
run: git switch main && git cherry-pick release && git push