45
45
validate-release-tag :
46
46
runs-on : ubuntu-latest
47
47
needs : [check-cargo-publish]
48
+ outputs :
49
+ cargo-version : ${{ steps.validate.outputs.cargo-version }}
50
+ is-rc : ${{ steps.validate.outputs.is-rc }}
48
51
steps :
49
52
- name : Validate release tag format
53
+ id : validate
50
54
# Note, `workflow_run.head_branch` does not contain `refs/tags/` prefix, just the tag name, i.e. `v0.4.0` or `v0.4.0-rc.1`
51
55
# Valid formats: v<major>.<minor>.<patch> OR v<major>.<minor>.<patch>-rc.<release_candidate>
52
56
run : |
@@ -59,12 +63,40 @@ jobs:
59
63
exit 1
60
64
fi
61
65
echo "✅ Release tag format is valid: $RELEASE_TAG"
66
+
67
+ # Strip 'v' prefix for cargo version
68
+ CARGO_VERSION="${RELEASE_TAG#v}"
69
+ echo "Cargo version (without v prefix): $CARGO_VERSION"
70
+
71
+ # Check if this is a release candidate
72
+ if [[ "$RELEASE_TAG" =~ -rc\.[0-9]+$ ]]; then
73
+ IS_RC="true"
74
+ echo "This is a release candidate"
75
+ else
76
+ IS_RC="false"
77
+ echo "This is a stable release"
78
+ fi
79
+
80
+ # Set outputs for other jobs to use
81
+ echo "cargo-version=$CARGO_VERSION" >> $GITHUB_OUTPUT
82
+ echo "is-rc=$IS_RC" >> $GITHUB_OUTPUT
62
83
63
84
sdist :
64
85
runs-on : ubuntu-latest
65
86
needs : [validate-release-tag]
66
87
steps :
67
88
- uses : actions/checkout@v4
89
+
90
+ - name : Install cargo-edit
91
+ if : ${{ needs.validate-release-tag.outputs.is-rc == 'true' }}
92
+ run : cargo install cargo-edit
93
+
94
+ - name : Set cargo version for RC
95
+ if : ${{ needs.validate-release-tag.outputs.is-rc == 'true' }}
96
+ run : |
97
+ echo "Setting cargo version to: ${{ needs.validate-release-tag.outputs.cargo-version }}"
98
+ cargo set-version ${{ needs.validate-release-tag.outputs.cargo-version }}
99
+
68
100
- uses : PyO3/maturin-action@v1
69
101
with :
70
102
working-directory : " bindings/python"
@@ -93,6 +125,17 @@ jobs:
93
125
- { os: ubuntu-latest, target: "armv7l" }
94
126
steps :
95
127
- uses : actions/checkout@v4
128
+
129
+ - name : Install cargo-edit
130
+ if : ${{ needs.validate-release-tag.outputs.is-rc == 'true' }}
131
+ run : cargo install cargo-edit
132
+
133
+ - name : Set cargo version for RC
134
+ if : ${{ needs.validate-release-tag.outputs.is-rc == 'true' }}
135
+ run : |
136
+ echo "Setting cargo version to: ${{ needs.validate-release-tag.outputs.cargo-version }}"
137
+ cargo set-version ${{ needs.validate-release-tag.outputs.cargo-version }}
138
+
96
139
- uses : actions/setup-python@v5
97
140
with :
98
141
python-version : 3.9
0 commit comments