2525 - patch
2626 - minor
2727 - major
28+ - rc
29+ - beta
30+ - alpha
31+ - release
32+ - version
33+ version :
34+ description : Version (used with level "version")
35+ required : false
36+ type : string
2837 dry_run :
2938 description : Dry run
3039 required : true
4049 CACHE : true
4150
4251jobs :
52+ semver_check :
53+ name : Check Semver
54+ runs-on : ubuntu-latest
55+ steps :
56+ - name : Git checkout
57+ uses : actions/checkout@v4
58+
59+ - name : Setup Environment
60+ uses : ./.github/actions/setup
61+ with :
62+ cargo-cache-key : cargo-semver-checks
63+ toolchain : test
64+ components : release, semver-checks
65+
66+ - name : Set Version
67+ run : |
68+ if [ "${{ inputs.level }}" == "version" ]; then
69+ LEVEL=${{ inputs.version }}
70+ else
71+ LEVEL=${{ inputs.level }}
72+ fi
73+
74+ git config --global user.email "[email protected] " 75+ git config --global user.name "github-actions"
76+
77+ cargo release $LEVEL --manifest-path ${{ inputs.crate }}/Cargo.toml --no-tag --no-publish --no-push --no-confirm --execute
78+
79+ - name : Check semver
80+ run : |
81+ pnpm semver ${{ inputs.crate }}
82+
83+
4384 publish_release :
4485 name : Publish
4586 runs-on : ubuntu-latest
87+ needs : semver_check
4688 steps :
4789 - name : Ensure CARGO_REGISTRY_TOKEN variable is set
4890 env :
61103 with :
62104 cargo-cache-key : cargo-publish
63105 toolchain : test
64- components : release, semver-checks
106+ components : release
65107 solana : true
66108
67109 - name : Build
@@ -75,22 +117,24 @@ jobs:
75117 git config --global user.email "[email protected] " 76118 git config --global user.name "github-actions"
77119
78- - name : Check semver
79- run : |
80- pnpm semver ${{ inputs.crate }} --release-type ${{ inputs.level }}
81-
82120 - name : Publish Crate
83121 id : publish
84122 env :
85123 CARGO_REGISTRY_TOKEN : ${{ secrets.CARGO_REGISTRY_TOKEN }}
86124 run : |
125+ if [ "${{ inputs.level }}" == "version" ]; then
126+ LEVEL=${{ inputs.version }}
127+ else
128+ LEVEL=${{ inputs.level }}
129+ fi
130+
87131 if [ "${{ inputs.dry_run }}" == "true" ]; then
88132 OPTIONS="--dry-run"
89133 else
90134 OPTIONS=""
91135 fi
92136
93- pnpm tsx ./scripts/publish.mts ${{ inputs.crate }} ${{ inputs.level }} $OPTIONS
137+ pnpm tsx ./scripts/publish.mts ${{ inputs.crate }} $LEVEL $OPTIONS
94138
95139 - name : Create GitHub release
96140 if : github.event.inputs.dry_run != 'true' && github.event.inputs.create_release == 'true'
0 commit comments