Publish Release #94
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: | |
version: | |
description: 'Version for Release.' | |
required: false | |
default: '' | |
skip_checks: | |
type: boolean | |
required: false | |
default: false | |
description: 'Skip pre-release checks and skip straight to the actual release' | |
skip_release: | |
type: boolean | |
required: false | |
default: false | |
description: 'Only run pre-release checks' | |
concurrency: | |
group: publish-release | |
cancel-in-progress: false | |
jobs: | |
log: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: "Log inputs" | |
env: | |
INPUTS: ${{ toJson(inputs) }} | |
run: echo "${INPUTS}" | jq -r | |
- name: "Log event" | |
env: | |
EVENT: ${{ toJson(github.event) }} | |
run: echo "${EVENT}" | jq -r | |
check-branch: | |
if: (startsWith(github.ref, 'refs/heads/release/v') || startsWith(github.ref, 'refs/heads/hotfix/v')) | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Branch | |
run: | | |
echo "${{ github.ref }}" | |
check-goreleaser: | |
runs-on: ${{ vars.RELEASE_RUNNER }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Build release snapshot | |
if: inputs.skip_checks != true | |
run: | | |
make release-snapshot | |
publish-release: | |
permissions: | |
id-token: write | |
contents: write | |
attestations: write | |
if: inputs.skip_release != true | |
needs: | |
- check-branch | |
- check-goreleaser | |
runs-on: ${{ vars.RELEASE_RUNNER }} | |
timeout-minutes: 60 | |
environment: release | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Change Log Release Notes. | |
id: release_notes | |
run: | | |
awk '/^## /{flag++} flag==1{print}' changelog.md > changelog-current.md | |
cat changelog-current.md | |
- name: Set Version | |
run: | | |
echo "GITHUB_TAG_VERSION=${{ inputs.version }}" >> ${GITHUB_ENV} | |
- name: Create Release Tag | |
shell: bash | |
run: | | |
git tag ${GITHUB_TAG_VERSION} | |
create_tag=$(git push --tags || echo "tag exists") | |
if [[ $create_tag == "tag exists" ]]; then | |
echo "Delete existing tag to re-create" | |
git tag -d ${GITHUB_TAG_VERSION} | |
git push --delete origin ${GITHUB_TAG_VERSION} | |
echo "sleep for 5 seconds to let github catch up." | |
sleep 5 | |
echo "Re-Create Tag." | |
git tag ${GITHUB_TAG_VERSION} | |
git push --tags | |
fi | |
- name: Create GitHub Release | |
uses: softprops/action-gh-release@v2.2.0 | |
with: | |
prerelease: true | |
token: ${{ secrets.GITHUB_TOKEN }} | |
body_path: changelog-current.md | |
tag_name: ${{ env.GITHUB_TAG_VERSION }} | |
generate_release_notes: false | |
- name: Publish Release Files | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
GORELEASER_CURRENT_TAG: ${{ env.GITHUB_TAG_VERSION }} | |
run: | | |
touch .release-env | |
make release | |
- name: Artifact Attestations | |
id: attestation | |
uses: actions/attest-build-provenance@v2 | |
with: | |
subject-path: | | |
dist/zetacored_**/* | |
dist/zetaclientd_**/* | |
dist/checksums.txt | |
- name: Upload Attestation Bundle | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
shell: bash | |
run: | | |
gh release upload ${{ env.GITHUB_TAG_VERSION }} ${{ steps.attestation.outputs.bundle-path }} | |
- name: Clean Up Workspace | |
if: always() | |
shell: bash | |
run: sudo rm -rf * || echo "failed to cleanup workspace please investigate" | |
publish-typescript: | |
needs: publish-release | |
uses: ./.github/workflows/publish-typescript.yml | |
secrets: inherit |