1
0
This commit is contained in:
Stephan 2021-12-12 18:59:37 +01:00
parent febd814501
commit 888cfb7f0c

View File

@ -6,40 +6,24 @@ jobs:
if: startsWith(github.ref, 'refs/heads/release/') if: startsWith(github.ref, 'refs/heads/release/')
steps: steps:
- name: Somebody Kill Me
run: |
# this *does* show the v7.7.10 release in the list
echo "ALL RELEASES"
curl -H "Accept: application/vnd.github.v3+json" -u "zpqrtbnk:${{secrets.MY_GITHUB_TOKEN_TESTREPO}}" https://api.github.com/repos/zpqrtbnk/test-repo/releases
# this ... fails
echo "TAG RELEASE"
curl -H "Accept: application/vnd.github.v3+json" -u "zpqrtbnk:${{secrets.MY_GITHUB_TOKEN_TESTREPO}}" https://api.github.com/repos/zpqrtbnk/test-repo/releases/tags/v7.7.10
- name: Validate the release - name: Validate the release
uses: actions/github-script@v4 uses: actions/github-script@v4
with: with:
# needed to see draft releases when getting all releases? # token needed to see draft releases when getting all releases
github-token: ${{ secrets.MY_GITHUB_TOKEN_TESTREPO }} github-token: ${{ secrets.MY_GITHUB_TOKEN_TESTREPO }}
script: | script: |
const ver = "${{ github.ref }}".substring(19) const ver = "${{ github.ref }}".substring(19)
const tag = "v" + ver const tag = "v" + ver
var rel = null var rel = null
try { try {
// this does *not* return draft releases // this does *not* return draft releases, so we have to list them
//rel = await github.repos.getReleaseByTag({ //rel = await github.repos.getReleaseByTag({ ... })
// owner: context.repo.owner,
// repo: context.repo.repo,
// tag: tag
//})
const rels = await github.repos.listReleases({ const rels = await github.repos.listReleases({
owner: context.repo.owner, owner: context.repo.owner,
repo: context.repo.repo repo: context.repo.repo
}) })
console.log(rels.data) // is [ { ... }, { ... } ]
for (const r of rels.data) { for (const r of rels.data) {
console.log('REL:') // is 0, 1 MEH?!
console.log(r)
if (r.tag_name === tag) { if (r.tag_name === tag) {
rel = r rel = r
break break
@ -99,12 +83,19 @@ jobs:
script: | script: |
const ver = "${{ github.ref }}".substring(19) const ver = "${{ github.ref }}".substring(19)
const tag = "v" + ver const tag = "v" + ver
// this is going to fail var rel = null
const rel = await github.repos.getReleaseByTag({ // no, see above
owner: context.repo.owner, //const rel = await github.repos.getReleaseByTag({ ... })
repo: context.repo.repo, const rels = await github.repos.listReleases({
tag: tag owner: context.repo.owner,
}) repo: context.repo.repo
})
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,