Skip to content

Commit 23ae98d

Browse files
committed
🤖 ci: Generate a release tag
Changelog: ci
1 parent 0f077ef commit 23ae98d

1 file changed

Lines changed: 24 additions & 0 deletions

File tree

.github/workflows/flutter-build.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,28 @@ jobs:
4141
with:
4242
name: release-apk
4343
path: build/app/outputs/flutter-apk/app-release.apk
44+
45+
# New steps for creating tag and release
46+
- name: Generate build timestamp
47+
id: timestamp
48+
run: echo "timestamp=$(date +'%Y%m%d%H%M%S')" >> $GITHUB_OUTPUT
49+
50+
- name: Create tag
51+
id: create_tag
52+
if: github.event_name != 'pull_request' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master')
53+
run: |
54+
TAG_NAME="v$(grep 'version:' pubspec.yaml | awk '{print $2}' | tr -d "'")-build-${{ steps.timestamp.outputs.timestamp }}"
55+
git tag $TAG_NAME
56+
git push origin $TAG_NAME
57+
echo "tag=$TAG_NAME" >> $GITHUB_OUTPUT
58+
59+
- name: Create Release
60+
if: github.event_name != 'pull_request' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master')
61+
uses: ncipollo/release-action@v1
62+
with:
63+
tag: ${{ steps.create_tag.outputs.tag }}
64+
name: Release ${{ steps.create_tag.outputs.tag }}
65+
artifacts: "build/app/outputs/flutter-apk/app-release.apk"
66+
token: ${{ secrets.GITHUB_TOKEN }}
67+
generateReleaseNotes: true
4468

0 commit comments

Comments
 (0)