This commit is contained in:
Stephan 2021-12-10 18:36:27 +01:00
parent 139af4526d
commit fe62eb455c

View File

@ -19,9 +19,23 @@ jobs:
}) })
} }
catch (error) { catch (error) {
core.setFailed("Could not find a release for tag '" + tag + "'.") core.setFailed(`Could not find a release for tag '${tag}'.`)
} }
# VERIFY THAT THE TAG DOES NOT ALREADY EXIST? if (rel.draft) {
core.setFailed(`Release for tag '${tag}' is already published.`)
}
try {
const ref = await github.git.getRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: 'tags/' + tag
})
core.setFailed(`Tag '${tag}' already exists.`)
}
catch (error) {
// this is expected
}
// everything is OK
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
@ -42,7 +56,7 @@ jobs:
echo "Tag branch $branch as v$version" echo "Tag branch $branch as v$version"
git tag v$version git tag v$version
git push --tags git push --tags
git push :$branch #git push :$branch
- name: Publish the release - name: Publish the release
uses: actions/github-script@v4 uses: actions/github-script@v4