Skip to content

Commit a80cbd7

Browse files
committed
Add a workflow to automatically create a relase on tag.
- Triggered on x.y (or x.y-foo) tags - Zip and Tar archive are build and automatically added to the release. - Release is created as draft. User still have manually to publish on Github UI.
1 parent 75e3687 commit a80cbd7

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed

.github/workflows/release.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: On-Release
2+
3+
on:
4+
push:
5+
tags:
6+
- '[0-9]+.[0-9]+'
7+
- '[0-9]+.[0-9]+-[0-9a-zA-Z]+'
8+
9+
permissions:
10+
contents: write
11+
12+
jobs:
13+
create-release:
14+
name: create-release
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v4
18+
- name: Get release version from tag
19+
if: env.VERSION == ''
20+
run: |
21+
echo "VERSION=${{ github.ref_name }}" >> $GITHUB_ENV
22+
- name: Show the version
23+
run: |
24+
echo "Version is: $VERSION"
25+
- name: Create Github release
26+
env:
27+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28+
run: |
29+
gh release create $VERSION --draft --verify-tag --title $VERSION
30+
outputs:
31+
version: ${{ env.VERSION }}
32+
33+
create-archive:
34+
name: create-archive
35+
needs: ['create-release']
36+
runs-on: ubuntu-latest
37+
strategy:
38+
matrix:
39+
format: [zip, tar.gz]
40+
steps:
41+
- name: Create archive
42+
shell: bash
43+
env:
44+
format: ${{ matrix.format }}
45+
run: |
46+
version="${{ needs.create-release.outputs.version }}"
47+
archive_name="zim-testing-suite-${version}"
48+
git archive --prefix="${archive_name}/" --output ${archive_name}.${{ env.format }} ${version}:data/
49+
50+
- name: Upload archive
51+
env:
52+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
53+
format: ${{ matrix.format }}
54+
run: |
55+
version="${{ needs.create-release.outputs.version }}"
56+
archive="zim-testing-suite-${version}.${{ env.format }}"
57+
gh release upload "$version" $archive

0 commit comments

Comments
 (0)