Skip to content

Commit 24c5b94

Browse files
authored
chore: configure release tagging (#4)
Signed-off-by: Rishav Dhar <19497993+rdhar@users.noreply.github.com>
1 parent 4119caa commit 24c5b94

File tree

1 file changed

+34
-0
lines changed

1 file changed

+34
-0
lines changed

.github/workflows/release.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
---
2+
name: Release
3+
4+
on:
5+
release:
6+
types: [published]
7+
8+
jobs:
9+
Release:
10+
runs-on: [ubuntu-24.04]
11+
12+
permissions:
13+
contents: write # Required to checkout repository.
14+
id-token: write # Required for authentication.
15+
packages: write # Required to publish packages.
16+
17+
steps:
18+
- name: Checkout repository
19+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
20+
with:
21+
fetch-tags: true
22+
persist-credentials: false
23+
24+
- name: Tag release
25+
env:
26+
GH_TAG: ${{ github.event.release.tag_name}}
27+
GH_TOKEN: ${{ github.token }}
28+
run: |
29+
version=${GH_TAG%%.*}
30+
gh api /repos/${{ github.repository }}/git/refs/tags/${version} --method PATCH --silent --field sha="${GITHUB_SHA}" --field force=true || \
31+
gh api /repos/${{ github.repository }}/git/refs --method POST --silent --field sha="${GITHUB_SHA}" --field ref="refs/tags/${version}"
32+
33+
- name: Publish package
34+
uses: actions/publish-immutable-action@4bc8754ffc40f27910afb20287dbbbb675a4e978 # v0.0.4

0 commit comments

Comments
 (0)