Skip to content

Commit f4099fb

Browse files
committed
ci: Update release workflow to use arbitrary references
This allows unnamed references to be released, which is necessary now that the release workflow produces tag references.
1 parent 3837465 commit f4099fb

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

.github/workflows/release.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ on:
2424
required: false
2525
type: boolean
2626
default: false
27+
ref:
28+
description: "Reference of the commit to release (default: ${{ github.ref }})"
29+
required: false
30+
type: string
31+
default: ""
2732

2833
env:
2934
CARGO_INCREMENTAL: 0
@@ -43,14 +48,13 @@ jobs:
4348
steps:
4449
- id: meta
4550
env:
46-
SHA: ${{ github.sha }}
4751
VERSION: ${{ inputs.version }}
4852
shell: bash
4953
run: |
5054
set -euo pipefail
5155
shopt -s extglob
5256
if [[ '${{ github.event_name }}' == "pull_request" ]]; then
53-
echo version="0.0.0-test.${SHA:0:7}"
57+
echo version="0.0.0-test.${GITHUB_SHA:0:7}"
5458
echo archs='["amd64"]'
5559
exit 0
5660
fi >> "$GITHUB_OUTPUT"
@@ -78,6 +82,7 @@ jobs:
7882
version: ${{ steps.meta.outputs.version }}
7983
package: ${{ github.event_name == 'workflow_dispatch' || steps.changed.outputs.any_changed == 'true' }}
8084
profile: ${{ inputs.profile || 'release' }}
85+
ref: ${{ inputs.ref || github.ref }}
8186

8287
info:
8388
needs: meta
@@ -91,10 +96,12 @@ jobs:
9196
echo 'inputs.tag-prefix: ${{ inputs.tag-prefix }}'
9297
echo 'inputs.profile: ${{ inputs.profile }}'
9398
echo 'inputs.publish: ${{ inputs.publish }}'
99+
echo 'inputs.ref: ${{ inputs.ref }}'
94100
echo 'needs.meta.outputs.archs: ${{ needs.meta.outputs.archs }}'
95101
echo 'needs.meta.outputs.version: ${{ needs.meta.outputs.version }}'
96102
echo 'needs.meta.outputs.package: ${{ needs.meta.outputs.package }}'
97103
echo 'needs.meta.outputs.profile: ${{ needs.meta.outputs.profile }}'
104+
echo 'needs.meta.outputs.ref: ${{ needs.meta.outputs.ref }}'
98105
99106
package:
100107
needs: meta
@@ -146,6 +153,8 @@ jobs:
146153
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
147154
# Tag the release.
148155
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633
156+
with:
157+
ref: ${{ needs.meta.outputs.ref }}
149158
- run: git tag -a -m "v${{ needs.meta.outputs.version }}" "$TAG"
150159
# Fetch the artifacts.
151160
- uses: actions/download-artifact@c850b930e6ba138125429b7e5c93fc707a7f8427

0 commit comments

Comments
 (0)