Publish Release #5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish Release | |
on: | |
workflow_dispatch: | |
inputs: | |
tag: | |
type: string | |
required: true | |
description: "The tag to release" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: checkout | |
uses: actions/checkout@v4 | |
- name: Check git tag doesn't already exist | |
run: | | |
if git tag -l | grep -q ${{ inputs.tag }}; then | |
echo "Git tag ${{ inputs.tag }} already exists" | |
exit 1 | |
fi | |
- name: Download latest.json | |
run: | | |
gh release download ${{ inputs.tag }} --pattern "latest.json" --clobber | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Get version | |
id: version | |
run: echo "version=$(jq -r '.version' latest.json)" >> $GITHUB_OUTPUT | |
- name: Check same version | |
run: | | |
if [ "${{ inputs.tag }}" != "${{ steps.version.outputs.version }}" ]; then | |
echo "Tag from input and version from latest.json are different" | |
exit 1 | |
fi | |
- name: Update latest.json | |
run: | | |
git add latest.json | |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git config --local user.name "github-actions[bot]" | |
git commit -m "Bumped version to ${{ inputs.tag }}" | |
git tag ${{ inputs.tag }} | |
git push | |
- name: Mark release as not draft | |
run: gh release edit ${{ inputs.tag }} --draft=false | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |