Skip to content

Commit d2d90c6

Browse files
authored
chore: release ci (#50)
1 parent f4a7f78 commit d2d90c6

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed

.github/workflows/release.yaml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: release
2+
on:
3+
push:
4+
tags:
5+
- "v*"
6+
workflow_dispatch:
7+
inputs:
8+
release_version:
9+
description: "Release version"
10+
required: true
11+
default: ""
12+
create_release:
13+
description: "Create release"
14+
required: true
15+
default: "true"
16+
upload_artifacts:
17+
description: "Upload artifacts"
18+
required: true
19+
default: "true"
20+
21+
env:
22+
BIN_NAME: iroh-c-ffi
23+
IROH_FORCE_STAGING_RELAYS: "1"
24+
25+
jobs:
26+
create-release:
27+
name: create-release
28+
runs-on: ubuntu-latest
29+
outputs:
30+
upload_url: ${{ steps.release.outputs.upload_url }}
31+
release_version: ${{ env.RELEASE_VERSION }}
32+
steps:
33+
- name: Get the release version from the tag (push)
34+
shell: bash
35+
if: env.RELEASE_VERSION == '' && github.event_name == 'push'
36+
run: |
37+
# See: https://github.community/t5/GitHub-Actions/How-to-get-just-the-tag-name/m-p/32167/highlight/true#M1027
38+
echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
39+
echo "version is: ${{ env.RELEASE_VERSION }}"
40+
- name: Get the release version from the tag (dispatch)
41+
shell: bash
42+
if: github.event_name == 'workflow_dispatch'
43+
run: |
44+
echo "RELEASE_VERSION=${{ github.event.inputs.release_version }}" >> $GITHUB_ENV
45+
echo "version is: ${{ env.RELEASE_VERSION }}"
46+
- name: Checkout repository
47+
uses: actions/checkout@v4
48+
with:
49+
fetch-depth: 1
50+
- name: Create GitHub release
51+
id: release
52+
if: github.event.inputs.create_release == 'true' || github.event_name == 'push'
53+
uses: actions/create-release@v1
54+
env:
55+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
56+
with:
57+
tag_name: ${{ env.RELEASE_VERSION }}
58+
release_name: ${{ env.RELEASE_VERSION }}

0 commit comments

Comments
 (0)