Skip to content

Publish release on tag creation #15

Publish release on tag creation

Publish release on tag creation #15

Workflow file for this run

name: Publish release on tag creation
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'
jobs:
check_version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Get shortened version of release tag
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Check release version is set correctly in every file
run: python3 utilities/check-version.py ${{ env.RELEASE_VERSION }}
run_tests:
uses: ./.github/workflows/ci.yml
needs:
- check_version
package:
name: Package source files
runs-on: ubuntu-latest
needs:
- check_version
- run_tests
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Get shortened version of release tag
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Package source code
shell: bash
run: |
find * | grep -v "\.git\|pytest.ini" | tar -czvf HAMLET-${{ env.RELEASE_VERSION }}.tar.gz --files-from -
- name: Print event context
env:
EVENT_CONTEXT: ${{ toJSON(github.event) }}
run: |
echo $EVENT_CONTEXT
- name: Upload archive as artifact
uses: actions/upload-artifact@v4
with:
name: release-tar
path: HAMLET-${{ env.RELEASE_VERSION }}.tar.gz
retention-days: 1
release:
name: Create release
needs:
- check_version
- run_tests
- package
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Get shortened version of release tag
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
- name: Download release tarball
uses: actions/download-artifact@v4
with:
name: release-tar
- name: Create release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create \
${{ env.RELEASE_VERSION}} \
--generate-notes \
HAMLET-${{ env.RELEASE_VERSION}}.tar.gz \