From 20a5d57d235bfc709d4a0af3956d3dbee3cacb2f Mon Sep 17 00:00:00 2001 From: Nate Sesti Date: Tue, 20 Aug 2024 17:01:41 -0700 Subject: [PATCH] fix publish CI scripts to run only on correct release --- .github/workflows/main.yaml | 23 ++++++++++++++++++----- .github/workflows/preview.yaml | 23 ++++++++++++++++++----- 2 files changed, 36 insertions(+), 10 deletions(-) diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index b9e408df2..8e57aede7 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -1,14 +1,27 @@ name: Publish Extension on: - push: - tags: - - "v0.8.*-vscode" - branches: - - main + release: + types: [released] jobs: + check_release_name: + runs-on: ubuntu-latest + outputs: + should_run: ${{ steps.check.outputs.should_run }} + steps: + - id: check + working-directory: . + run: | + if [[ "${{ github.event.release.tag_name }}" == v0.8.*-vscode ]]; then + echo "should_run=true" >> $GITHUB_OUTPUT + else + echo "should_run=false" >> $GITHUB_OUTPUT + fi + build: + needs: check_release_name + if: needs.check_release_name.outputs.should_run == 'true' strategy: matrix: include: diff --git a/.github/workflows/preview.yaml b/.github/workflows/preview.yaml index 87b28f9df..a87079e18 100644 --- a/.github/workflows/preview.yaml +++ b/.github/workflows/preview.yaml @@ -1,14 +1,27 @@ name: Publish Preview Extension on: - push: - tags: - - "v0.9.*-vscode" - branches: - - dev + release: + types: [prereleased] jobs: + check_release_name: + runs-on: ubuntu-latest + outputs: + should_run: ${{ steps.check.outputs.should_run }} + steps: + - id: check + working-directory: . + run: | + if [[ "${{ github.event.release.tag_name }}" == v0.9.*-vscode ]]; then + echo "should_run=true" >> $GITHUB_OUTPUT + else + echo "should_run=false" >> $GITHUB_OUTPUT + fi + build: + needs: check_release_name + if: needs.check_release_name.outputs.should_run == 'true' strategy: matrix: include: