44 push :
55 tags :
66 - ' v[0-9]+.[0-9]+.[0-9]+'
7- - ' v[0-9]+.[0-9]+.[0-9]+-dev[0-9]+'
8- - ' v[0-9]+.[0-9]+.[0-9]+-alpha[0-9]+'
9- - ' v[0-9]+.[0-9]+.[0-9]+-beta[0-9]+'
10- - ' v[0-9]+.[0-9]+.[0-9]+-prerelease[0-9]+'
11- - ' v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+'
12-
13- permissions :
14- contents : read
15- pages : write
16- id-token : write
17- repository-projects : read
18- packages : read
197
208jobs :
21- publish :
9+ prechecks :
2210 runs-on : ubuntu-latest
23- container :
24- image : ghcr.io/goldenm-software/flutter-web-builder:flutter3.38.3-uv-python3.13
25- options : --user root
26- credentials :
27- username : ${{ github.repository_owner }}
28- password : ${{ secrets.GITHUB_TOKEN }}
29-
30- env :
31- PUB_JSON : ${{ secrets.LAYRZ_PUB_TOKEN }}
3211
3312 steps :
3413 - name : Checkout
35- uses : actions/checkout@v4
36-
37- - name : Get tag version
38- run : |
39- echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
40-
41- - name : Authenticate
14+ uses : actions/checkout@v6
15+ - name : Check tag format
4216 run : |
43- python3 authenticate.py
17+ if [[ ! "${GITHUB_REF#refs/tags/}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
18+ echo "Tag name does not match semantic versioning format vX.Y.Z"
19+ exit 1
20+ fi
4421
45- - name : Publish
22+ - name : Check main branch
4623 run : |
47- flutter pub publish --force
48-
49- - name : Cleanup
24+ LATEST_COMMIT=$(git rev-parse HEAD)
25+ MAIN_COMMIT=$(git rev-parse origin/main)
26+ if [ "$LATEST_COMMIT" != "$MAIN_COMMIT" ]; then
27+ echo "The tag must be created from the latest commit on the main branch."
28+ exit 1
29+ fi
30+
31+ deploy-dart :
32+ needs : prechecks
33+ runs-on : ubuntu-latest
34+
35+ permissions :
36+ id-token : write
37+ contents : write
38+
39+ steps :
40+ - name : Checkout
41+ uses : actions/checkout@v6
42+
43+
44+ - name : Setup Flutter
45+ uses : flutter-actions/setup-flutter@v4
46+ with :
47+ channel : stable
48+ version : 3.38.8
49+ cache : true
50+ cache-sdk : true
51+
52+ - name : Install dependencies
53+ run : flutter pub get
54+
55+ - name : Run checks
56+ run : flutter analyze
57+
58+ - name : Dry run
59+ run : flutter pub publish --dry-run
60+
61+ - name : Publish to pub.dev
62+ uses : dart-lang/setup-dart@v1
63+ with :
64+ sdk : stable
65+
66+ - name : Publish to pub.dev
67+ run : flutter pub publish --force
68+
69+ - name : Rename tag when fails
70+ if : failure()
5071 run : |
51- dart pub token remove https://pub.dev
72+ git config --global user.name "github-actions[bot]"
73+ git config --global user.email "github-actions[bot]@users.noreply.github.com"
74+ TIMESTAMP=$(date +%Y%m%d-%H%M%S)
75+ TAG_NAME=${GITHUB_REF#refs/tags/}
76+ NEW_TAG="failed-${TAG_NAME}-${TIMESTAMP}"
77+ git tag $NEW_TAG
78+ git push origin $NEW_TAG
79+ git push --delete origin $TAG_NAME
5280
53- buils-site :
81+ - name : Create GitHub Release
82+ if : success()
83+ uses : softprops/action-gh-release@v1
84+ with :
85+ tag_name : ${{ github.ref_name }}
86+ name : Release ${{ github.ref_name }}
87+ draft : false
88+ prerelease : false
89+ generate_release_notes : true
90+ env :
91+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
92+
93+ build-site :
5494 runs-on : ubuntu-latest
55- container :
56- image : ghcr.io/goldenm-software/flutter-web-builder:flutter3.38.3-uv-python3.13
57- options : --user root
58- credentials :
59- username : ${{ github.repository_owner }}
60- password : ${{ secrets.GITHUB_TOKEN }}
95+ needs : deploy-dart
96+
97+ permissions :
98+ pages : write
99+ id-token : write
61100
62101 steps :
63102 - name : Checkout
64- uses : actions/checkout@v4
103+ uses : actions/checkout@v6
104+
105+
106+ - name : Setup Flutter
107+ uses : flutter-actions/setup-flutter@v4
108+ with :
109+ channel : stable
110+ version : 3.38.8
111+ cache : true
65112
66113 - name : Setup Pages
67114 id : setup_pages
68- uses : actions/configure-pages@v4.0.0
115+ uses : actions/configure-pages@v5
69116
70117 - name : Build
71118 run : |
72119 cd example
73120 flutter build web --release --base-href=${{ steps.setup_pages.outputs.base_path }}/ --no-tree-shake-icons --wasm
74121
75122 - name : Upload artifact
76- uses : actions/upload-pages-artifact@v3.0.0
123+ uses : actions/upload-pages-artifact@v4
77124 with :
78- # Upload entire repository
79125 path : ' ./example/build/web'
80126
81127 - name : Deploy to GitHub Pages
82128 id : deployment
83- uses : actions/deploy-pages@v4.0.3
129+ uses : actions/deploy-pages@v4
0 commit comments