-
Notifications
You must be signed in to change notification settings - Fork 299
70 lines (59 loc) · 2.23 KB
/
update-version.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
name: Update Meson Version and Recreate Release
on:
release:
types: [published]
jobs:
update-version:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 0
- name: Install GitHub CLI
run: sudo apt-get install -y gh
- name: Extract version from release
id: extract_version
run: echo "version=${{ github.event.release.tag_name }}" >> $GITHUB_ENV
- name: Fetch release description
id: fetch_description
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
TAG_NAME=${{ env.version }}
DESCRIPTION=$(gh release view $TAG_NAME --json body -q .body)
echo "description=$DESCRIPTION" >> $GITHUB_ENV
- name: Update meson.build
run: |
VERSION=${{ env.version }}
sed -i "s/^\(\s*version\s*:\s*'\)[^']*'/\1${VERSION}'/" meson.build
- name: Commit changes
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git add meson.build
git commit -m "Update version to ${{ env.version }}"
git push origin HEAD:refs/heads/master
- name: Force-update tag
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
TAG_NAME=${{ env.version }}
git tag -fa $TAG_NAME -m "Update tag to include version update"
git push origin --force $TAG_NAME
- name: Recreate release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
TAG_NAME=${{ env.version }}
DESCRIPTION=${{ env.description }}
gh release delete $TAG_NAME --yes
gh release create $TAG_NAME --target $(git rev-parse HEAD) --title "$TAG_NAME" --notes "$DESCRIPTION"
- name: Trigger other workflows
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
TAG_NAME=${{ env.version }}
gh workflow run .github/workflows/build-source.yml --ref $TAG_NAME
gh workflow run .github/workflows/build-package.yml --ref $TAG_NAME