-
Notifications
You must be signed in to change notification settings - Fork 126
53 lines (52 loc) · 2 KB
/
create-release.yaml
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
name: "Publish new release"
on:
pull_request:
branches:
- main
types:
- closed
- labeled
jobs:
release:
name: Publish new release
runs-on: ubuntu-latest
if: github.event.pull_request.merged && contains( github.event.pull_request.labels.*.name, 'Release')
steps:
- name: Extract version from branch name (for release branches)
if: startsWith(github.event.pull_request.head.ref, 'release/')
run: |
BRANCH_NAME="${{ github.event.pull_request.head.ref }}"
VERSION=${BRANCH_NAME#release/}
echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v4
- name: Initialize mandatory git config
run: |
git config user.name "GitHub actions"
git config user.email [email protected]
- name: Pushing tags
env:
RELEASE_VERSION: ${{ env.RELEASE_VERSION }}
run: |
VER=$(echo v${{ env.RELEASE_VERSION }} | sed 's/.*rc.*/rc/')
echo "RC=$VER" >> $GITHUB_ENV
git tag -a -m "Release v${{ env.RELEASE_VERSION }}" "v${{ env.RELEASE_VERSION }}"
git push origin v${{ env.RELEASE_VERSION }}
- name: Extract release notes
id: extract-release-notes
uses: ffurrer2/extract-release-notes@v1
env:
RELEASE_VERSION: ${{ env.RELEASE_VERSION }}
with:
# we produce this file for creating the release with gh later on
release_notes_file: RELEASE_NOTES_v${{ env.RELEASE_VERSION }}.md
- name: Create release
env:
RELEASE_VERSION: ${{ env.RELEASE_VERSION }}
GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }}
run: gh release create v${{ env.RELEASE_VERSION }} --title "Release v${{env.RELEASE_VERSION}}" --notes-file RELEASE_NOTES_v${{ env.RELEASE_VERSION }}.md
- name: Trigger publish crates workflow
uses: benc-uk/workflow-dispatch@v1
with:
workflow: Publish crates
token: ${{ secrets.PAT_TOKEN }}