metanorma/packed-mn #144
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. Possible values: x.y.z, major, minor, patch or pre|rc|etc | |
required: true | |
default: 'skip' | |
jobs: | |
push-tag: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
token: ${{ secrets.METANORMA_CI_PAT_TOKEN }} | |
- name: Add writable remote | |
run: | | |
git config --global user.name "metanorma-ci" | |
git config --global user.email "[email protected]" | |
- name: Install xmllint | |
run: | | |
sudo apt-get update -y | |
sudo apt-get install -y libxml2-utils | |
- uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: '3.1' | |
- name: Parse metanorma-cli version | |
env: | |
METANORMA_CLI_TAG: ${{ github.event.client_payload.ref || github.event.inputs.next_version }} | |
run: | | |
curl -LO --retry 3 https://raw.githubusercontent.com/metanorma/metanorma-build-scripts/main/gemver-to-semver.rb && chmod +x gemver-to-semver.rb | |
echo "PACKAGE_VERSION=$(./gemver-to-semver.rb --chocolatey ${METANORMA_CLI_TAG})" >> $GITHUB_ENV | |
- name: Update metanorma.nuspec | |
run: | | |
xmllint --shell metanorma.nuspec << EOF | |
setns ns=http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd | |
cd /ns:package/ns:metadata/ns:version | |
set ${PACKAGE_VERSION} | |
save | |
exit | |
EOF | |
- name: Prepare URL and SHA256 files | |
env: | |
METANORMA_CLI_TAG: ${{ github.event.client_payload.ref || github.event.inputs.next_version }} | |
run: | | |
METANORMA_EXE_URL="https://github.com/metanorma/packed-mn/releases/download/v${METANORMA_CLI_TAG#*/v}/metanorma-windows-x86_64.exe" | |
echo "${METANORMA_EXE_URL}" > tools/metanorma.url.txt | |
curl -sL "${METANORMA_EXE_URL}" | sha256sum | cut -d ' ' -f 1 > tools/metanorma.sha256.txt | |
echo "Metanorma URL: $(cat tools/metanorma.url.txt) SHA265: $(cat tools/metanorma.sha256.txt)" | |
- name: Push commit and tag | |
run: | | |
git add metanorma.nuspec | |
git add tools/metanorma.sha256.txt | |
git add tools/metanorma.url.txt | |
git commit -m "Bump version to ${PACKAGE_VERSION}" | |
git tag v${PACKAGE_VERSION} | |
git push origin HEAD:${GITHUB_REF} --tags |