Skip to content

Commit

Permalink
fix github job outputs mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
proton committed Nov 27, 2023
1 parent 1ea319a commit 26bafa3
Showing 1 changed file with 5 additions and 25 deletions.
30 changes: 5 additions & 25 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ jobs:
check_tag:
runs-on: ubuntu-latest

outputs:
version: ${{ steps.extract_version.outputs.test }}
version_exists: ${{ steps.check_tag.outputs.version_exists }}

steps:
- name: Checkout code
uses: actions/checkout@v4
Expand All @@ -20,42 +24,18 @@ jobs:
run: |
VERSION=$(grep 'version"' package.json | cut -d '"' -f 4)
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "::set-output name=version::$VERSION"
- name: Check if the tag exists
id: check_tag
run: |
if git rev-parse --quiet --verify "refs/tags/${{ steps.extract_version.outputs.version }}" >/dev/null; then
echo "The tag ${{ steps.extract_version.outputs.version }} exists. Workflow will be canceled."
echo "version_exists=true" >> $GITHUB_OUTPUT
echo "::set-output name=version_exists::true"
else
echo "The tag ${{ steps.extract_version.outputs.version }} does not exist."
echo "version_exists=false" >> $GITHUB_OUTPUT
echo "::set-output name=version_exists::false"
fi
- name: Debug
run: |
cat $GITHUB_OUTPUT
debug:
runs-on: ubuntu-latest
needs: check_tag

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Debug1
run: |
cat $GITHUB_OUTPUT
- name: Debug2
run: |
echo "Version exists: ${{ needs.check_tag.outputs.version_exists }}"
echo "Version1: ${{ needs.check_tag.outputs.version }}"
echo "Version2: ${{ steps.extract_version.outputs.version }}"
tag_and_release:
runs-on: ubuntu-latest
needs: check_tag
Expand Down

0 comments on commit 26bafa3

Please sign in to comment.