Skip to content

Create Release

Create Release #56

name: Create Release
on:
workflow_dispatch:
inputs:
tag:
description: 'The new version to tag, ex: 1.0.5'
required: true
type: string
jobs:
create-release:
runs-on: ubuntu-latest
permissions: write-all
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Create Release
run: |
set -euo pipefail
export RULES_PYTHON_RELEASE=$(curl -s https://api.github.com/repos/bazelbuild/rules_python/releases/latest | jq -c .)
export RULES_PYTHON_TAG=$(echo $RULES_PYTHON_RELEASE | jq -r '.tag_name')
export RULES_PYTHON_URL=$(echo $RULES_PYTHON_RELEASE | jq -r '.assets[].browser_download_url')
export RULES_PYTHON_SHA256=$(curl -s $RULES_PYTHON_URL | sha256sum)
git config user.name "${{ github.triggering_actor }}"
git config user.email "${{ github.triggering_actor }}@users.noreply.github.com"
export PREFIX="${NAME}-${TAG}"
export ARCHIVE="$PREFIX.tar.gz"
sha=$(git rev-parse HEAD)
git archive --format=tar --prefix="${NAME}-${TAG}/" $sha | gzip > $ARCHIVE
export SHA256=$(shasum -a 256 $ARCHIVE | awk '{print $1}')
cat .github/workflows/release-notes.md | envsubst > notes.md
gh release create "v$TAG" --title "$TAG" --target $sha --generate-notes --notes "$(cat notes.md)" $ARCHIVE
env:
NAME: "ofiuco"
TAG: ${{ inputs.tag }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}