Compare commits
19 Commits
master
...
release/7.
Author | SHA1 | Date | |
---|---|---|---|
|
c014e91817 | ||
|
888cfb7f0c | ||
|
febd814501 | ||
|
91716319e5 | ||
|
95a34adfba | ||
|
0865ac62e2 | ||
|
fa26cc9ba1 | ||
|
06622d8529 | ||
|
6e884a3321 | ||
|
26f94b13a3 | ||
|
543d33a363 | ||
|
08c6b3a2e3 | ||
|
fe62eb455c | ||
|
139af4526d | ||
|
fdc6d95388 | ||
|
55e21143a9 | ||
|
4e2e9638b6 | ||
|
6a103e03a3 | ||
|
a2e2213ce4 |
82
.github/workflows/publish-release.yml
vendored
82
.github/workflows/publish-release.yml
vendored
|
@ -5,47 +5,97 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: startsWith(github.ref, 'refs/heads/release/')
|
if: startsWith(github.ref, 'refs/heads/release/')
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
- name: Validate the release
|
- name: Validate the release
|
||||||
uses: actions/github-script@v4
|
uses: actions/github-script@v4
|
||||||
with:
|
with:
|
||||||
|
|
||||||
|
# token needed to see draft releases when getting all releases
|
||||||
|
github-token: ${{ secrets.MY_GITHUB_TOKEN_TESTREPO }}
|
||||||
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({
|
var rel = null
|
||||||
|
try {
|
||||||
|
// this does *not* return draft releases, so we have to list them
|
||||||
|
//rel = await github.repos.getReleaseByTag({ ... })
|
||||||
|
const rels = await github.repos.listReleases({
|
||||||
|
owner: context.repo.owner,
|
||||||
|
repo: context.repo.repo
|
||||||
|
})
|
||||||
|
for (const r of rels.data) {
|
||||||
|
if (r.tag_name === tag) {
|
||||||
|
rel = r
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (error) {
|
||||||
|
core.setFailed(`Could not find a release for tag ${tag}.`)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (rel === null) {
|
||||||
|
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,
|
owner: context.repo.owner,
|
||||||
repo: context.repo.repo,
|
repo: context.repo.repo,
|
||||||
tag: tag
|
ref: 'tags/' + tag
|
||||||
})
|
})
|
||||||
if (rel === null) {
|
core.setFailed(`Tag ${tag} already exists.`)
|
||||||
core.setFailed("Could not find a release for tag " + tag)
|
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 rel = await github.repos.getReleaseByTag({
|
const tag = "v" + ver
|
||||||
|
var rel = null
|
||||||
|
// no, see above
|
||||||
|
//const rel = await github.repos.getReleaseByTag({ ... })
|
||||||
|
const rels = await github.repos.listReleases({
|
||||||
owner: context.repo.owner,
|
owner: context.repo.owner,
|
||||||
repo: context.repo.repo,
|
repo: context.repo.repo
|
||||||
tag: tag
|
|
||||||
})
|
})
|
||||||
|
for (const r of rels.data) {
|
||||||
|
if (r.tag_name === tag) {
|
||||||
|
rel = r
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
await github.repos.updateRelease({
|
await github.repos.updateRelease({
|
||||||
owner: context.repo.owner,
|
owner: context.repo.owner,
|
||||||
repo: context.repo.repo,
|
repo: context.repo.repo,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user