Skip to content

Commit

Permalink
Cancel release if version was already released
Browse files Browse the repository at this point in the history
Ported from Carpet's action
  • Loading branch information
altrisi authored Jun 19, 2023
1 parent 9b26a46 commit d1cc4b0
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,22 @@ jobs:
if ! ${{ steps.properties.outputs.release-extra-branch }}; then
echo "matrix-to-exclude=Snapshots" >> $GITHUB_OUTPUT
fi
- uses: actions/github-script@v6
env:
READ_VERSION: ${{ steps.properties.outputs.mod_version }}
with:
script: |
const { READ_VERSION } = process.env;
console.log('Read version is: ' + READ_VERSION);
let releases = (await github.rest.repos.listReleases({
owner: context.repo.owner,
repo: context.repo.repo
})).data;
console.log('Previous release was: ' + releases[1].name);
for (let release of releases.slice(1)) {
if (release.name.includes(READ_VERSION))
core.setFailed('Version number is the same as a previous release!')
}
Build-And-Publish:
runs-on: ubuntu-latest
needs: [Get-Properties]
Expand Down

0 comments on commit d1cc4b0

Please sign in to comment.