1
0
This commit is contained in:
Stephan 2021-12-10 17:27:14 +01:00
parent de64657f2c
commit bb1ee93cb9

View File

@ -1,15 +1,30 @@
name: Manually Do Something name: Publish a release
on: workflow_dispatch on: workflow_dispatch
jobs: jobs:
job: job:
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
uses: github-script@v4
with:
script: |
const tag = "v" + github.ref.substring(19)
const rel = github.repos.getReleaseByTag({
owner: context.repo.owner,
repo: context.repo.repo,
tag: tag
})
if (rel === null) {
core.setFailed("Could not find a release for tag " + tag)
}
- name: Checkout - name: Checkout
uses: actions/checkout@v2 uses: actions/checkout@v2
with: with:
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
- name: Do Something
- name: Finalize the release
run: | run: |
version="${{ github.ref }}" version="${{ github.ref }}"
version="${version:19}" # trim starting 'refs/heads/release/' (19 chars) version="${version:19}" # trim starting 'refs/heads/release/' (19 chars)
@ -18,3 +33,21 @@ jobs:
git config user.email "github-actions@zpqrtbnk.net" git config user.email "github-actions@zpqrtbnk.net"
git config user.name "GitHub Actions (Do Something)" git config user.name "GitHub Actions (Do Something)"
git push --tags git push --tags
git push :${{ github.ref }}
- name: Publish the release
uses: github-script@v4
with:
script: |
const tag = "v" + github.ref.substring(19)
const rel = github.repos.getReleaseByTag({
owner: context.repo.owner,
repo: context.repo.repo,
tag: tag
})
github.repos.updateRelease({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: rel.id,
draft: false
})