Skip to content

Commit

Permalink
Add a workflow to automatically create a relase on tag.
Browse files Browse the repository at this point in the history
- 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.
  • Loading branch information
mgautierfr committed Jun 14, 2024
1 parent 75e3687 commit bc1a0ef
Showing 1 changed file with 57 additions and 0 deletions.
57 changes: 57 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: On-Release

on:
push:
tags:
- '[0-9]+.[0-9]+'
- '[0-9]+.[0-9]+-[0-9a-zA-Z]+'

permissions:
contents: write

jobs:
create-release:
name: create-release
runs-on: ubuntu-latest
steps:
- name: Get release version from tag
if: env.VERSION == ''
run: |
echo "VERSION=${{ github.ref_name }}" >> $GITHUB_ENV
- name: Show the version
run: |
echo "Version is: $VERSION"
- name: Create Github release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create $VERSION --draft --verify-tag --title $VERSION
outputs:
version: ${{ env.VERSION }}

create-archive:
name: create-archive
needs: ['create-release']
runs-on: ubuntu-latest
strategy:
matrix:
format: [zip, tar.gz]
steps:
- uses: actions/checkout@v4
- name: Create archive
shell: bash
env:
format: ${{ matrix.format }}
run: |
version="${{ needs.create-release.outputs.version }}"
archive_name="zim-testing-suite-${version}"
git archive --prefix="${archive_name}/" --output ${archive_name}.${{ env.format }} ${version}:data/
- name: Upload archive
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
format: ${{ matrix.format }}
run: |
version="${{ needs.create-release.outputs.version }}"
archive="zim-testing-suite-${version}.${{ env.format }}"
gh release upload "$version" $archive

0 comments on commit bc1a0ef

Please sign in to comment.