Skip to content

Commit 992505b

Browse files
Let the release workflow create the version tag
Releases can then be published from the Actions tab without pushing a tag.
1 parent 7e3fbb8 commit 992505b

1 file changed

Lines changed: 12 additions & 5 deletions

File tree

‎.github/workflows/release.yml‎

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,20 @@
11
name: Release
22

3-
# Publishes a GitHub release for a version tag, with the matching section of
4-
# CHANGELOG.md as notes and a zip of the site ready to host.
3+
# Publishes a GitHub release for a version, with the matching section of
4+
# CHANGELOG.md as notes and a zip of the site ready to host. Runs when a version
5+
# tag is pushed, or by hand, in which case the tag is created on `target`.
56
on:
67
push:
78
tags: ['v*']
89
workflow_dispatch:
910
inputs:
1011
tag:
11-
description: Tag to publish (e.g. v0.1.0)
12+
description: Version tag (e.g. v0.2.0)
1213
required: true
14+
target:
15+
description: Branch or full commit SHA to tag
16+
required: true
17+
default: main
1318

1419
permissions:
1520
contents: write
@@ -37,8 +42,10 @@ jobs:
3742
env:
3843
GH_TOKEN: ${{ github.token }}
3944
TAG: ${{ inputs.tag || github.ref_name }}
45+
TARGET: ${{ inputs.target || github.sha }}
4046
run: |
41-
git archive --format=zip --prefix="sinklink-$TAG/" -o "sinklink-$TAG.zip" "$TAG" \
47+
commit=$(git rev-parse --verify "$TARGET^{commit}")
48+
git archive --format=zip --prefix="sinklink-$TAG/" -o "sinklink-$TAG.zip" "$commit" \
4249
index.html styles src assets LICENSE README.md
4350
gh release create "$TAG" "sinklink-$TAG.zip" \
44-
--verify-tag --title "SinkLink $TAG" --notes-file notes.md
51+
--target "$commit" --title "SinkLink $TAG" --notes-file notes.md

0 commit comments

Comments
 (0)