metanorma/packed-mn #114
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@v1 | |
- name: Add writable remote | |
run: | | |
git config --global user.name "metanorma-ci" | |
git config --global user.email "[email protected]" | |
git remote add github "https://metanorma-ci:${{ secrets.METANORMA_CI_PAT_TOKEN }}@github.com/$GITHUB_REPOSITORY.git" | |
git pull github ${GITHUB_REF} --ff-only | |
- 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 add snap/snapcraft.yaml | |
git commit -m "Bump version to ${SNAP_VERSION}" | |
git tag v${SNAP_VERSION} | |
git push github HEAD:${GITHUB_REF} --tags |