36 Commits

Author SHA1 Message Date
GitHub Actions
a7c8068c7c Foo 2021-12-12 21:36:47 +00:00
Stephan
f7c5b3e956 wtf 2021-12-12 22:36:34 +01:00
Stephan
4dc95bf252 wtf 2021-12-12 22:31:46 +01:00
Stephan
dc7dd1e768 wtf 2021-12-12 22:28:58 +01:00
Stephan
8add493c77 wtf 2021-12-12 22:26:18 +01:00
Stephan
30bcef5c7f wtf 2021-12-12 22:23:58 +01:00
Stephan
f9a41a087c wtf 2021-12-12 20:18:20 +01:00
Stephan
35131167a6 wtf 2021-12-12 20:10:29 +01:00
Stephan
d215b853f8 wtf 2021-12-12 20:05:37 +01:00
Stephan
84a970f8a4 fix 2021-12-12 20:04:09 +01:00
Stephan
31cbe74bb2 fix 2021-12-12 20:03:48 +01:00
Stephan
108af45b25 fix 2021-12-12 19:57:31 +01:00
Stephan
100a1b61f4 fix 2021-12-12 19:51:17 +01:00
Stephan
d44e0c8512 fix 2021-12-12 19:48:34 +01:00
Stephan
8f36bf3ee6 fix 2021-12-12 19:46:03 +01:00
Stephan
890c988757 fix 2021-12-12 19:44:49 +01:00
Stephan
bedc122eda fix 2021-12-12 19:43:20 +01:00
Stephan
e87cd570d2 .12 2021-12-12 19:42:25 +01:00
Stephan
888cfb7f0c wtf 2021-12-12 18:59:37 +01:00
Stephan
febd814501 wtf 2021-12-10 20:14:59 +01:00
Stephan
91716319e5 wtf 2021-12-10 20:10:08 +01:00
Stephan
95a34adfba wtf 2021-12-10 19:52:22 +01:00
Stephan
0865ac62e2 wtf 2021-12-10 19:47:20 +01:00
Stephan
fa26cc9ba1 wtf 2021-12-10 19:45:07 +01:00
Stephan
06622d8529 wtf 2021-12-10 19:36:59 +01:00
Stephan
6e884a3321 wtf 2021-12-10 19:34:47 +01:00
Stephan
26f94b13a3 wtf 2021-12-10 19:32:14 +01:00
Stephan
543d33a363 wtf 2021-12-10 19:04:10 +01:00
Stephan
08c6b3a2e3 wtf 2021-12-10 18:38:01 +01:00
Stephan
fe62eb455c wtf 2021-12-10 18:36:27 +01:00
Stephan
139af4526d wtf 2021-12-10 18:31:32 +01:00
Stephan
fdc6d95388 wtf 2021-12-10 18:29:29 +01:00
Stephan
55e21143a9 wtf 2021-12-10 18:22:59 +01:00
Stephan
4e2e9638b6 wtf 2021-12-10 18:17:13 +01:00
Stephan
6a103e03a3 wtf 2021-12-10 18:13:01 +01:00
Stephan
a2e2213ce4 pii 2021-12-10 18:10:02 +01:00
2 changed files with 86 additions and 26 deletions

40
.github/workflows/hz.js vendored Normal file
View File

@@ -0,0 +1,40 @@
// see https://github.com/actions/github-script
// , core, glob, io, exec, require
module.exports = function (github, context) {
var module = {}
// this is *not* exported
function noop ( ) { }
// this *is* exported
module.getReleaseByTag = async function (tag_name) {
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_name) {
rel = r
break
}
}
}
catch (error) {
return null
}
return rel
}
module.getRefReleaseTag = function (ref) {
// test, must start with 'refs/heads/release/' 19 chars
return "v" + ref.substring(19)
}
return module;
}

View File

@@ -1,25 +1,49 @@
name: Publish Release
on: workflow_dispatch
name: Publish
#meh
on:
workflow_dispatch:
inputs:
confirm:
description: "This is really going to release. Enter \'yolo\' to confirm that you really want to do it."
required: true
default: ""
jobs:
job:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/heads/release/')
steps:
- name: Validate the release
- name: Confirm
uses: actions/github-script@v4
with:
script: |
const ver = "${{ github.ref }}".substring(19)
const tag = "v" + ver
var rel
try {
rel = await github.repos.getReleaseByTag({
owner: context.repo.owner,
repo: context.repo.repo,
tag: tag
})
if ("${{ github.event.inputs.confirm }}" != "yolo") {
core.setFailed(`Not confirmed (confirm = '${{ github.event.inputs.confirm }}').`)
}
catch (error) {
- name: Checkout
uses: actions/checkout@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Validate the release
uses: actions/github-script@v4
with:
# token needed to see draft releases when getting all releases
github-token: ${{ secrets.MY_GITHUB_TOKEN_TESTREPO }}
script: |
const hz = require("./.github/workflows/hz.js")(github, context)
const ref = "${{ github.ref }}"
const tag = hz.getRefReleaseTag(ref)
if (tag === null) {
core.setFailed(`Invalid reference ${ref} is not release/<version>.`)
return
}
var rel = await hz.getReleaseByTag(tag)
if (rel === null) {
core.setFailed(`Could not find a release for tag ${tag}.`)
return
}
@@ -40,12 +64,7 @@ jobs:
// this is expected
}
// everything is OK
- name: Checkout
uses: actions/checkout@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Configure repository
shell: bash
run: |
@@ -66,13 +85,14 @@ jobs:
uses: actions/github-script@v4
with:
script: |
const ver = "${{ github.ref }}".substring(19)
const tag = "v" + ver
const rel = await github.repos.getReleaseByTag({
owner: context.repo.owner,
repo: context.repo.repo,
tag: tag
})
const hz = require("./.github/workflows/hz.js")(github, context)
const ref = "${{ github.ref }}"
const tag = hz.getRefReleaseTag(ref)
if (tag === null) {
core.setFailed(`Invalid reference ${ref} is not release/<version>.`)
return
}
var rel = await hz.getReleaseByTag(tag)
await github.repos.updateRelease({
owner: context.repo.owner,
repo: context.repo.repo,