metanorma/packed-mn #127
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: release-tag | |
on: | |
repository_dispatch: | |
types: [ metanorma/packed-mn ] | |
workflow_dispatch: | |
inputs: | |
next_version: | |
description: | | |
Next release version. | |
required: true | |
jobs: | |
push-tag: | |
runs-on: ubuntu-20.04 | |
if: startsWith(github.event.client_payload.ref, 'refs/tags/v') || github.event_name == 'workflow_dispatch' | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.METANORMA_CI_PAT_TOKEN }} | |
- if: ${{ github.event_name == 'workflow_dispatch' }} | |
run: echo SNAP_VERSION=${{ github.event.inputs.next_version }} >> ${GITHUB_ENV} | |
- if: ${{ github.event_name == 'repository_dispatch' }} | |
run: echo SNAP_VERSION=${METANORMA_CLI_TAG#*/v} >> ${GITHUB_ENV} | |
env: | |
METANORMA_CLI_TAG: ${{ github.event.client_payload.ref }} | |
- run: | | |
sudo apt update && sudo apt install -y snapd | |
sudo snap install yq | |
- run: ./snap-set-version.sh ${SNAP_VERSION} | |
- name: Push commit and tag | |
run: | | |
git config --global user.name "metanorma-ci" | |
git config --global user.email "[email protected]" | |
git add snap/snapcraft.yaml | |
git commit -m "Bump version to ${SNAP_VERSION}" | |
git tag v${SNAP_VERSION} | |
git push origin HEAD:${GITHUB_REF} --tags |