This repository has been archived by the owner on Apr 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
61 lines (60 loc) · 2 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
60
61
name: release
on:
workflow_dispatch:
inputs:
version:
required: true
type: choice
default: minor
options:
- patch
- minor
jobs:
update-version:
name: Update Version and release
runs-on: ubuntu-latest
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 code
uses: actions/checkout@v3
- id: changelog
name: Generate CHANGELOG
uses: reearth/changelog-action@main
with:
version: ${{ github.event.inputs.version }}
repo: ${{ github.repository }}
config: .github/changelog.yml
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: Extract non-"v" part of version
id: version
env:
TAG: ${{ steps.changelog.outputs.version }}
run: |
new_version=$(echo "$TAG" | sed 's/^v//')
echo "::set-output name=new_version::$new_version"
- name: Update version
env:
VER: ${{ steps.version.outputs.new_version }}
run: |
current_version=$(awk '/version: [0-9]+\.[0-9]+\.[0-9]+/{print $2}' plugin/public/reearth.yml)
sed -i "s/$current_version/$VER/" plugin/public/reearth.yml
- name: Commit and push to release
env:
TAG: ${{ steps.changelog.outputs.version }}
run: |
rm CHANGELOG_latest.md
git add CHANGELOG.md plugin/public/reearth.yml
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