Skip to content

Commit 76b097a

Browse files
committed
fix: update CI/CD to deploy on tag push only
1 parent 3d3a6a2 commit 76b097a

1 file changed

Lines changed: 6 additions & 18 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ name: CI/CD
22

33
on:
44
push:
5-
branches: [ "**" ]
5+
branches: [ "main" ]
6+
tags: [ "v*" ]
67
pull_request:
7-
branches: [ "**" ]
8+
branches: [ "main" ]
89

910
permissions:
1011
contents: write
@@ -30,7 +31,8 @@ jobs:
3031
deploy:
3132
needs: test
3233
runs-on: ubuntu-latest
33-
if: github.ref == 'refs/heads/main'
34+
# Only run deploy if it is a tag push
35+
if: startsWith(github.ref, 'refs/tags/v')
3436
steps:
3537
- uses: actions/checkout@v4
3638
- uses: dart-lang/setup-dart@v1
@@ -39,19 +41,5 @@ jobs:
3941
- name: Install dependencies
4042
run: dart pub get
4143

42-
- name: Check Pubspec Version
43-
id: version
44-
run: |
45-
VERSION=$(grep 'version:' pubspec.yaml | cut -d ' ' -f 2)
46-
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
47-
echo "Found version: $VERSION"
48-
49-
- name: Create Git Tag
50-
uses: mathieudutour/github-tag-action@v6.1
51-
with:
52-
github_token: ${{ secrets.GITHUB_TOKEN }}
53-
custom_tag: ${{ steps.version.outputs.VERSION }}
54-
tag_prefix: "v"
55-
5644
- name: Publish to Pub.dev
57-
run: dart pub publish --force
45+
run: dart pub publish --force

0 commit comments

Comments
 (0)