-
Notifications
You must be signed in to change notification settings - Fork 38
43 lines (40 loc) · 1.61 KB
/
publish.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
name: Publish to pub.dev
on:
push:
tags:
- v[0-9]+.[0-9]+.[0-9]+
# Publish using the reusable workflow from dart-lang.
jobs:
publish:
permissions:
contents: read
id-token: write
uses: famedly/frontend-ci-templates/.github/workflows/publish-pub.yml@main
with:
env_file: ".github/workflows/versions.env"
create_gh_release:
env:
GH_TOKEN: ${{ github.token }}
needs: [publish]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Create release
run: |
version=$(echo ${{ github.ref_name }} | sed 's/^v//')
releaseRegex="^v[0-9]+\.[0-9]+\.[0-9]+$"
releaseCandidateRegex="^v[0-9]+\.[0-9]+\.[0-9]+rc[0-9]+$"
notes=$(./scripts/extract_changelog.sh $version)
if [ -n "$notes" ]; then
if [[ ${{ github.ref_name }} =~ $releaseRegex ]]; then
gh release create ${{ github.ref_name }} --notes "$notes" -t ${{ github.ref_name }} --verify-tag
elif [[ ${{ github.ref_name }} =~ $releaseCandidateRegex ]]; then
gh release create ${{ github.ref_name }} --notes "$notes" --prerelease -t ${{ github.ref_name }} --verify-tag
fi
else
if [[ ${{ github.ref_name }} =~ $releaseRegex ]]; then
gh release create ${{ github.ref_name }} --generate-notes -t ${{ github.ref_name }} --verify-tag
elif [[ ${{ github.ref_name }} =~ $releaseCandidateRegex ]]; then
gh release create ${{ github.ref_name }} --generate-notes --prerelease -t ${{ github.ref_name }} --verify-tag
fi
fi