Skip to content

Commit

Permalink
Merge pull request mintexists#6 from jukefr/master
Browse files Browse the repository at this point in the history
ci(pee): Try to fix release action yet again
  • Loading branch information
mintexists authored Mar 30, 2022
2 parents f758d22 + 4526157 commit 9ddb3a1
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,35 +8,36 @@ on:
- master # this tells it to run when commits are made to master

jobs:
check_versions:
check_versions_job:
runs-on: ubuntu-latest
outputs: # this is kinda fucky in the way it works ngl
version: ${{ steps.check_versions.outputs.version }} # this uses the id from the step itself, not the job (they are the same)
continue: ${{ steps.check_versions.outputs.continue }}
version_output: ${{ steps.check_version_step.outputs.version }}
continue_output: ${{ steps.should_continue_step.outputs.continue }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
id: check_versions
- run: git describe --tags --abbrev=0 > /tmp/latest_tag # we get the latest tag and store it
- run: echo "latest git tag is $(cat /tmp/latest_tag)"
- run: jq -r ".version" package.json > /tmp/current_version # we get the current package.json version and store it
- run: echo "packge.json version is $(cat /tmp/current_version)"
- run: echo "::set-output name=version::$(cat /tmp/current_version)" # we set the current version as variable for the next job in case we continue
- id: check_version_step
run: echo "::set-output name=version::$(cat /tmp/current_version)" # we set the current version as variable for the next job in case we continue
# we compare the two version, if mismatch we want a new release (run next job), if not we dont run the next job
- run: cmp --silent /tmp/latest_tag /tmp/current_version && echo "::set-output name=continue::false" || echo "::set-output name=continue::true"
- id: should_continue_step
run: cmp --silent /tmp/latest_tag /tmp/current_version && echo "::set-output name=continue::false" || echo "::set-output name=continue::true"
release_on_bump:
needs: [check_versions]
if: needs.check_versions.outputs.continue == 'true' # this is uses the id from the job, not the step from the job (in case it changes)
needs: [check_versions_job]
if: needs.check_versions_job.outputs.continue_output == 'true'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ needs.check_versions.outputs.version }}
release_name: Release ${{ needs.check_versions.outputs.version }}
body: Release ${{ needs.check_versions.outputs.version }}
tag_name: ${{ needs.check_versions_job.outputs.version_output }}
release_name: Release ${{ needs.check_versions_job.outputs.version_output }}
body: Release ${{ needs.check_versions_job.outputs.version_output }}
draft: false
prerelease: false

0 comments on commit 9ddb3a1

Please sign in to comment.