exp
This commit is contained in:
parent
4bc423721a
commit
43287ec9cf
58
.github/workflows/publish-release.yml
vendored
58
.github/workflows/publish-release.yml
vendored
|
@ -9,38 +9,64 @@ jobs:
|
||||||
uses: actions/github-script@v4
|
uses: actions/github-script@v4
|
||||||
with:
|
with:
|
||||||
script: |
|
script: |
|
||||||
console.log('X0')
|
const ver = "${{ github.ref }}".substring(19)
|
||||||
const tag = "v" + "${{ github.ref }}".substring(19)
|
const tag = "v" + ver
|
||||||
const rel = await github.repos.getReleaseByTag({
|
try {
|
||||||
owner: context.repo.owner,
|
const rel = await github.repos.getReleaseByTag({
|
||||||
repo: context.repo.repo,
|
owner: context.repo.owner,
|
||||||
tag: tag
|
repo: context.repo.repo,
|
||||||
})
|
tag: tag
|
||||||
if (rel === null) {
|
})
|
||||||
core.setFailed("Could not find a release for tag " + tag)
|
|
||||||
}
|
}
|
||||||
|
catch (error) {
|
||||||
|
core.setFailed(`Could not find a release for tag '${tag}'.`)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (rel.draft) {
|
||||||
|
core.setFailed(`Release for tag '${tag}' is already published.`)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
const ref = await github.git.getRef({
|
||||||
|
owner: context.repo.owner,
|
||||||
|
repo: context.repo.repo,
|
||||||
|
ref: 'tags/' + tag
|
||||||
|
})
|
||||||
|
core.setFailed(`Tag '${tag}' already exists.`)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
// this is expected
|
||||||
|
}
|
||||||
|
// everything is OK
|
||||||
|
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: Configure repository
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
git config user.email "github-actions@hazelcast.com"
|
||||||
|
git config user.name "GitHub Actions (Build Release)"
|
||||||
|
|
||||||
- name: Finalize the release
|
- name: Finalize the release
|
||||||
run: |
|
run: |
|
||||||
version="${{ github.ref }}"
|
ref="${{ github.ref }}"
|
||||||
version="${version:19}" # trim starting 'refs/heads/release/' (19 chars)
|
branch="${ref:11}" # trim starting 'refs/heads/' (11 chars)
|
||||||
echo "Tag ref ${{ github.ref }} as v$version"
|
version="${ref:19}" # trim starting 'refs/heads/release/' (19 chars)
|
||||||
|
echo "Tag branch $branch as v$version"
|
||||||
git tag v$version
|
git tag v$version
|
||||||
git config user.email "github-actions@zpqrtbnk.net"
|
|
||||||
git config user.name "GitHub Actions (Do Something)"
|
|
||||||
git push --tags
|
git push --tags
|
||||||
git push :${{ github.ref }}
|
#git push :$branch
|
||||||
|
|
||||||
- name: Publish the release
|
- name: Publish the release
|
||||||
uses: actions/github-script@v4
|
uses: actions/github-script@v4
|
||||||
with:
|
with:
|
||||||
script: |
|
script: |
|
||||||
const tag = "v" + "${{ github.ref }}".substring(19)
|
const ver = "${{ github.ref }}".substring(19)
|
||||||
|
const tag = "v" + ver
|
||||||
const rel = await github.repos.getReleaseByTag({
|
const rel = await github.repos.getReleaseByTag({
|
||||||
owner: context.repo.owner,
|
owner: context.repo.owner,
|
||||||
repo: context.repo.repo,
|
repo: context.repo.repo,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user