metanorma/metanorma-cli #341
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/metanorma-cli ] | |
workflow_dispatch: | |
inputs: | |
next_version: | |
description: | | |
Next release version. Possible values: x.y.z, major, minor, patch (or pre|rc|etc). | |
Also, you can pass 'skip' to skip 'git tag' and do 'gem push' for the current version | |
required: true | |
type: string | |
jobs: | |
prepare: | |
if: startsWith(github.event.client_payload.ref, 'refs/tags/v') || github.event_name == 'workflow_dispatch' | |
uses: metanorma/ci/.github/workflows/prepare-rake.yml@main | |
push-tag: | |
runs-on: ubuntu-latest | |
needs: prepare | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.METANORMA_CI_PAT_TOKEN }} | |
- name: Parse metanorma-cli version | |
if: github.event_name == 'repository_dispatch' | |
env: | |
METANORMA_CLI_TAG: ${{ github.event.client_payload.ref }} | |
run: | | |
echo METANORMA_CLI_VERSION=${METANORMA_CLI_TAG#*/v} >> ${GITHUB_ENV} | |
- name: Take metanorma-cli version from input | |
if: github.event_name == 'workflow_dispatch' | |
run: echo "METANORMA_CLI_VERSION=${{ inputs.next_version }}" >> ${GITHUB_ENV} | |
- uses: metanorma/metanorma-build-scripts/gh-rubygems-setup-action@main | |
with: | |
token: ${{ secrets.METANORMA_CI_PAT_TOKEN }} | |
- uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: ${{ needs.prepare.outputs.default-ruby-version }} | |
- name: Update version | |
run: | | |
bundle remove metanorma-cli | |
bundle add metanorma-cli -v ${METANORMA_CLI_VERSION} | |
bundle install --deployment | |
- name: Push commit and tag | |
run: | | |
git config --global user.name "metanorma-ci" | |
git config --global user.email "[email protected]" | |
git add Gemfile | |
git commit -m "Bump version to ${METANORMA_CLI_VERSION}" | |
git tag v${METANORMA_CLI_VERSION} | |
git push origin HEAD:${GITHUB_REF} --tags |