-
Notifications
You must be signed in to change notification settings - Fork 3
54 lines (47 loc) · 1.63 KB
/
create-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
name: Create GitHub Release
on:
push:
branches:
- main
permissions:
contents: write
pull-requests: write
jobs:
create-github-release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Determine current version in pubspec.yaml
id: pubspec-version-number
run: |
PUBSPEC_VERSION=$(yq ".version" pubspec.yaml)
echo "pubspec-version=$PUBSPEC_VERSION" >> $GITHUB_OUTPUT
- name: Check if version tag already exists
id: tag-check
run: |
TAG=v${{ steps.pubspec-version-number.outputs.pubspec-version }}
if git show-ref --tags --verify --quiet "refs/tags/${TAG}"; then
echo "Version tag $TAG already exists, not creating a new release."
else
echo "new-tag=$TAG" >> $GITHUB_OUTPUT
fi
- name: Generate release notes
uses: orhun/git-cliff-action@v3
if: ${{ steps.tag-check.outputs.new-tag != '' }}
with:
config: cliff.toml
args: --verbose --unreleased --strip header --tag ${{ steps.tag-check.outputs.new-tag }}
env:
OUTPUT: CHANGES.md
GITHUB_REPO: ${{ github.repository }}
- name: Create new GitHub release if tag does not exist yet
uses: ncipollo/release-action@v1
if: ${{ steps.tag-check.outputs.new-tag != '' }}
with:
tag: ${{ steps.tag-check.outputs.new-tag }}
bodyFile: CHANGES.md
name: Version ${{ steps.pubspec-version-number.outputs.pubspec-version }}
token: ${{ secrets.BOT_TOKEN }}