-
Notifications
You must be signed in to change notification settings - Fork 0
/
release.yml
52 lines (52 loc) · 1.57 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
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:
- name: Set up git config
run: |
git config --global user.name "${{ github.actor }}"
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
git config --global pull.rebase false
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.GPT }}
- 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