@@ -2,74 +2,95 @@ name: Release
22
33on :
44 workflow_dispatch :
5+ inputs :
6+ dry_run :
7+ description : " Dry run (no tags/releases created)"
8+ required : false
9+ default : " false"
10+ type : choice
11+ options :
12+ - " false"
13+ - " true"
14+
15+ permissions :
16+ contents : write
17+ pull-requests : write
18+ issues : write
19+
20+ env :
21+ PYTHON_SEMANTIC_RELEASE_VERSION : " 10.5.3"
522
623jobs :
724 lint :
8- if : github.ref == 'refs/heads/main' && github.actor == 'bot-anik '
25+ if : github.repository == 'axone-protocol/contracts '
926 uses : ./.github/workflows/lint.yml
1027
1128 build :
12- if : github.ref == 'refs/heads/main' && github.actor == 'bot-anik '
29+ if : github.repository == 'axone-protocol/contracts '
1330 uses : ./.github/workflows/build.yml
1431
1532 test :
16- if : github.ref == 'refs/heads/main' && github.actor == 'bot-anik '
33+ if : github.repository == 'axone-protocol/contracts '
1734 uses : ./.github/workflows/test.yml
1835
19- perform-release :
20- if : github.ref == 'refs/heads/main' && github.actor == 'bot-anik'
21- needs :
22- - lint
23- - build
24- - test
36+ check-configured-projects :
37+ if : github.repository == 'axone-protocol/contracts'
38+ needs : [lint, build, test]
2539 runs-on : ubuntu-22.04
40+ outputs :
41+ matrix : ${{ steps.set-matrix.outputs.matrix }}
2642 steps :
27- - name : Check out repository
28- uses : actions/checkout@v6
29- with :
30- token : ${{ secrets.OPS_TOKEN }}
43+ - uses : actions/checkout@v4
44+ - id : set-matrix
45+ run : |
46+ PROJECT_DIRS=$(find contracts packages -maxdepth 2 -name "pyproject.toml" -print0 \
47+ | xargs -0 -n1 dirname \
48+ | jq -R -s -c 'split("\n")[:-1]')
3149
32- - name : Import GPG key
33- uses : crazy-max/ghaction-import-gpg@v6
34- with :
35- gpg_private_key : ${{ secrets.BOT_GPG_PRIVATE_KEY }}
36- passphrase : ${{ secrets.BOT_GPG_PASSPHRASE }}
37- git_config_global : true
38- git_user_signingkey : true
39- git_commit_gpgsign : true
50+ echo "Found projects: $PROJECT_DIRS"
51+ echo "matrix=$PROJECT_DIRS" >> $GITHUB_OUTPUT
4052
41- - name : Setup node
42- uses : actions/setup-node@v6
53+ release :
54+ needs : check-configured-projects
55+ if : ${{ needs.check-configured-projects.outputs.matrix != '[]' && needs.check-configured-projects.outputs.matrix != '' }}
56+ runs-on : ubuntu-22.04
57+ strategy :
58+ fail-fast : false
59+ max-parallel : 1
60+ matrix :
61+ project_dir : ${{ fromJSON(needs.check-configured-projects.outputs.matrix) }}
62+ steps :
63+ - uses : actions/checkout@v4
4364 with :
44- node-version : 20
65+ fetch-depth : 0
66+ token : ${{ secrets.OPS_TOKEN }}
4567
46- - name : Setup jq
47- uses : dcarbone/install-jq-action@v3
48- with :
49- version : 1.7
50- force : true
68+ - name : Configure git author
69+ run : |
70+ git config user.name "${{ github.actor }}"
71+ git config user.email "${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com"
5172
52- - name : Setup rust
53- uses : actions-rust-lang/setup-rust-toolchain@v1
73+ - name : Sync to latest remote
74+ run : |
75+ git fetch --tags origin
76+ git fetch origin "+refs/heads/*:refs/remotes/origin/*"
77+ git checkout "${GITHUB_REF_NAME}"
78+ git reset --hard "origin/${GITHUB_REF_NAME}"
5479
55- - name : Install cargo make
56- uses : davidB/rust-cargo-make@v1
80+ - name : Python Semantic Release (Dry Run)
81+ if : github.event.inputs.dry_run == 'true'
82+ run : |
83+ pip install python-semantic-release==${{ env.PYTHON_SEMANTIC_RELEASE_VERSION }}
84+ cd ${{ matrix.project_dir }}
85+ semantic-release -vv --noop version
86+ env :
87+ GH_TOKEN : ${{ secrets.OPS_TOKEN }}
5788
58- - name : Release project
59- uses : cycjimmy/semantic-release-action@v5
89+ - name : Python Semantic Release (Real)
90+ if : github.event.inputs.dry_run != 'true'
91+ uses : python-semantic-release/python-semantic-release@v${{ env.PYTHON_SEMANTIC_RELEASE_VERSION }}
6092 with :
61- semantic_version : 22.0.5
62- branch : main
63- extra_plugins : |
64- @semantic-release/changelog
65- @semantic-release/exec@6.0.3
66- @semantic-release/git
67- semantic-release-replace-plugin@1.2.7
68- extends : |
69- conventional-changelog-conventionalcommits@7.0.1
70- env :
71- GITHUB_TOKEN : ${{ secrets.OPS_TOKEN }}
72- GIT_AUTHOR_NAME : ${{ vars.BOT_GIT_AUTHOR_NAME }}
73- GIT_AUTHOR_EMAIL : ${{ vars.BOT_GIT_AUTHOR_EMAIL }}
74- GIT_COMMITTER_NAME : ${{ vars.BOT_GIT_COMMITTER_NAME }}
75- GIT_COMMITTER_EMAIL : ${{ vars.BOT_GIT_COMMITTER_EMAIL }}
93+ config_file : ${{ matrix.project_dir }}/pyproject.toml
94+ github_token : ${{ secrets.OPS_TOKEN }}
95+ verbosity : 1
96+ strict : true
0 commit comments