Skip to content

Add a workflow to automatically create a relase on tag. #1

Add a workflow to automatically create a relase on tag.

Add a workflow to automatically create a relase on tag. #1

Workflow file for this run

name: On-Release
on:
push:
tags:
- '[0-9]+.[0-9]+'
- '[0-9]+.[0-9]+-[0-9a-zA-Z]+'
permission:

Check failure on line 9 in .github/workflows/release.yml

View workflow run for this annotation

GitHub Actions / On-Release

Invalid workflow file

The workflow is not valid. .github/workflows/release.yml (Line: 9, Col: 1): Unexpected value 'permission'
contents: write
jobs:
create-release:
name: create-release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- 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:
- 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