Skip to content

Commit

Permalink
ci: Update release-tag.yml to allow manual release
Browse files Browse the repository at this point in the history
  • Loading branch information
CAMOBAP committed Mar 10, 2024
1 parent b5a390a commit 875c213
Showing 1 changed file with 20 additions and 9 deletions.
29 changes: 20 additions & 9 deletions .github/workflows/release-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,39 @@ 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-latest
if: startsWith(github.event.client_payload.ref, 'refs/tags/v')
if: startsWith(github.event.client_payload.ref, 'refs/tags/v') || github.event_name == 'workflow_dispatch'
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
token: ${{ secrets.METANORMA_CI_PAT_TOKEN }}
- run: |
git config --global user.name "metanorma-ci"
git config --global user.email "metanorma-ci@users.noreply.github.com"

- name: Parse metanorma-cli version
if: ${{ github.event_name == 'workflow_dispatch' }}
run: echo METANORMA_CLI_VERSION=${{ github.event.inputs.next_version }} >> ${GITHUB_ENV}

- name: Parse metanorma-cli version
if: ${{ github.event_name == 'repository_dispatch' }}
run: echo METANORMA_CLI_VERSION=${METANORMA_CLI_TAG#*/v} >> ${GITHUB_ENV}
env:
METANORMA_CLI_TAG: ${{ github.event.client_payload.ref }}
run: |
echo METANORMA_CLI_VERSION=${METANORMA_CLI_TAG#*/v} >> ${GITHUB_ENV}

- name: Update Formula
run: |
./formula-set-version.sh ${METANORMA_CLI_VERSION}
run: ./formula-set-version.sh ${METANORMA_CLI_VERSION}

- name: Push commit and tag
run: |
git config --global user.name "metanorma-ci"
git config --global user.email "metanorma-ci@users.noreply.github.com"
git add Formula/metanorma.rb Formula/metanorma-dev.rb
git commit -m "Bump version to ${METANORMA_CLI_VERSION}"
git tag v${METANORMA_CLI_VERSION}
Expand Down

0 comments on commit 875c213

Please sign in to comment.