@@ -7,17 +7,11 @@ name: "Release workflow"
7
7
8
8
on :
9
9
push :
10
- workflow_dispatch :
11
- inputs :
12
- skip-release :
13
- description : " Enter 'y' to skip release to crates.io"
14
- default : " "
15
- required : false
16
- # branches:
17
- # - '!**'
18
- # tags:
19
- # # To include pre-releases: 'v0.1.[0-9]+-?*'
20
- # - 'v0.1.[0-9]+'
10
+ branches :
11
+ - ' !**'
12
+ tags :
13
+ # To include pre-releases: 'v0.1.[0-9]+-?*'
14
+ - ' v0.[0-9]+.[0-9]+'
21
15
22
16
env :
23
17
# Note: used for test and clippy, not for publish
@@ -46,22 +40,34 @@ jobs:
46
40
steps :
47
41
- uses : actions/checkout@v4
48
42
49
- - name : " Parse crate version from Cargo.toml"
43
+ # - name: "Parse crate version from Cargo.toml"
44
+ # id: parse-crate-version
45
+ # run: |
46
+ # crateVer=$(grep -Po '^version = "\K[^"]*' godot/Cargo.toml)
47
+ # if [[ -z "$crateVer" ]]; then
48
+ # echo "::error::Failed to parse crate version from godot/Cargo.toml."
49
+ # exit 1
50
+ # fi
51
+ #
52
+ # # Check if tag exists.
53
+ # git fetch --tags
54
+ # if git tag -l | grep -q "^v$crateVer$" ; then
55
+ # echo "::error::Tag 'v$crateVer' already exists."
56
+ # exit 2
57
+ # fi
58
+ #
59
+ # echo "GDEXT_PUBLISHED_VERSION=$crateVer" >> $GITHUB_OUTPUT
60
+ # echo "Validated version: $crateVer"
61
+
62
+ - name : " Parse crate version from tag"
50
63
id : parse-crate-version
51
64
run : |
52
- crateVer=$(grep -Po '^version = "\K[^"]*' godot/Cargo.toml )
65
+ crateVer=$(echo "$GITHUB_REF" | sed -n "s#refs/tags/v\(.*\)#\1#p" )
53
66
if [[ -z "$crateVer" ]]; then
54
- echo "::error::Failed to parse crate version from godot/Cargo.toml."
55
- exit 1
56
- fi
57
-
58
- # Check if tag exists.
59
- git fetch --tags
60
- if git tag -l | grep -q "^v$crateVer$" ; then
61
- echo "::error::Tag 'v$crateVer' already exists."
67
+ printf "\n::error::Failed to parse GitHub ref '$GITHUB_REF'.\n"
62
68
exit 2
63
69
fi
64
-
70
+
65
71
echo "GDEXT_PUBLISHED_VERSION=$crateVer" >> $GITHUB_OUTPUT
66
72
echo "Validated version : $crateVer"
67
73
@@ -160,12 +166,14 @@ jobs:
160
166
GDEXT_PUBLISHED_VERSION : ${{ needs.validation.outputs.GDEXT_PUBLISHED_VERSION }}
161
167
steps :
162
168
- uses : actions/checkout@v4
169
+ with :
170
+ ref : ' v${{ needs.validation.outputs.GDEXT_PUBLISHED_VERSION }}'
163
171
164
172
- name : " Install Rust (uncached)"
165
173
run : rustup update stable
166
174
167
- - name : " Tag base commit"
168
- run : git tag "v$GDEXT_PUBLISHED_VERSION"
175
+ # - name: "Tag base commit"
176
+ # run: git tag "v$GDEXT_PUBLISHED_VERSION"
169
177
170
178
# - name: "Commit raw changes"
171
179
# # Note: first block was for an alternative approach, where a separate `releases` branch tracks deployments.
@@ -195,22 +203,24 @@ jobs:
195
203
git commit -am "v${{ env.GDEXT_PUBLISHED_VERSION }} (with doc attributes)"
196
204
197
205
- name : " Tag processed commit + push"
198
- run : |
199
- git tag "docs-v$GDEXT_PUBLISHED_VERSION"
200
- git push origin "v$GDEXT_PUBLISHED_VERSION" "docs-v$GDEXT_PUBLISHED_VERSION"
206
+ run : |
207
+ docTag="docs-v$GDEXT_PUBLISHED_VERSION"
208
+ git tag "$docTag"
209
+ git push origin "$docTag"
201
210
202
211
publish :
203
212
runs-on : ubuntu-latest
204
213
if : ${{ github.event.inputs.skip-release != 'y' }}
205
214
# environment: 'Crates.io'
206
215
needs :
216
+ - validation
207
217
- docs-and-commit
208
218
steps :
209
219
# Note: we cannot dry-run the publishing, since crates depend on each other, and dry-run will fail if they aren't yet on crates.io.
210
220
# Sleep to leave crates.io and docs.rs some time to index the dependencies, before releasing dependents.
211
221
- uses : actions/checkout@v4
212
222
with :
213
- ref : releases
223
+ ref : ' v${{ needs.validation.outputs.GDEXT_PUBLISHED_VERSION }} '
214
224
215
225
- name : " Install Rust (uncached)"
216
226
run : rustup update stable
0 commit comments