Skip to content

Commit

Permalink
[BLD]: allow manual dispatch of JS release workflow (#3536)
Browse files Browse the repository at this point in the history
  • Loading branch information
codetheweb authored Jan 22, 2025
1 parent 286e9f3 commit 6a67d88
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions .github/workflows/release-javascript-client.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,39 @@ on:
tags:
- 'js_release_[0-9]+\.[0-9]+\.[0-9]+' # Match tags in the form js_release_X.Y.Z
- 'js_release_alpha_[0-9]+\.[0-9]+\.[0-9]+' # Match tags in the form js_release_alpha_X.Y.Z
workflow_dispatch:
inputs:
tag:
description: 'Tag to release'
required: true

jobs:
release:
strategy:
fail-fast: false
matrix:
registry: [ "https://registry.npmjs.org", "https://npm.pkg.github.com" ]
runs-on: ubuntu-latest
permissions: write-all
steps:
- name: Resolve tag
id: tag
shell: bash
run: |
# If the workflow was triggered by a push on a tag, use github.ref_name.
# If manually dispatched, use the tag value supplied in the workflow input.
if [[ "${{ github.event_name }}" == "push" ]]; then
echo "tag=${{ github.ref_name }}" >> $GITHUB_OUTPUT
else
echo "tag=${{ inputs.tag }}" >> $GITHUB_OUTPUT
fi
- name: Check if tag matches the pattern
run: |
if [[ "${{ github.ref }}" =~ ^refs/tags/js_release_alpha_[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
if [[ "${{ steps.tag.outputs.tag }}" =~ ^js_release_alpha_[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Tag matches the pattern js_release_alpha_X.Y.Z"
echo "NPM_SCRIPT=release_alpha" >> "$GITHUB_ENV"
elif [[ "${{ github.ref }}" =~ ^refs/tags/js_release_[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
elif [[ "${{ steps.tag.outputs.tag }}" =~ ^js_release_[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Tag matches the pattern js_release_X.Y.Z"
echo "NPM_SCRIPT=release" >> "$GITHUB_ENV"
else
Expand Down

0 comments on commit 6a67d88

Please sign in to comment.