File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2,9 +2,10 @@ name: CI/CD
22
33on :
44 push :
5- branches : [ "**" ]
5+ branches : [ "main" ]
6+ tags : [ "v*" ]
67 pull_request :
7- branches : [ "** " ]
8+ branches : [ "main " ]
89
910permissions :
1011 contents : write
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
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
You can’t perform that action at this time.
0 commit comments