Skip to content

Add GitHub publishing and CI publishing #1

Add GitHub publishing and CI publishing

Add GitHub publishing and CI publishing #1

Workflow file for this run

name: Publish GitHub Release
on:
push:
# Only release tags on the main branch
branches:
- 'main'
tags:
- 'v*' # e.g. v1.2.3
- '!v*[+]mc*' # exclude tags handled by publish.yaml
# Only allow running one build job at a time to optimise cache hits
concurrency:
group: builds
# Grant permission to create/update releases
permissions:
contents: write
env:
TAG: ${{ github.ref_name }}
jobs:
release:
runs-on: ubuntu-latest
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Get release
id: get
run: |
if gh api /repos/{owner}/{repo}/releases/tags/"$TAG" \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
> /dev/null
then
echo "found=true"
else
echo "found=false"
fi
# TODO create a release with the same title & body that modpublisher would use
#
# Note: modpublisher currently won't edit these when updating an existing release...
# TODO: add support for that upstream?
- name: Create release
if: ${{ steps.get.outputs.found == 'true' }}
run: |
gh release create "$TAG" --draft="false" \
--title "TODO" \
--notes "TODO"
# If the release exists, publish it by setting draft=false
- name: Update release
if: ${{ steps.get.outputs.found == 'false' }}
run: gh release edit "$TAG" --draft="false"