Files
bottom/.github/workflows/post_release.yml

95 lines
2.8 KiB
YAML

# Actions to run after releasing a version, like:
# - Generating documentation via mkdocs
# - Notifying packaging repos
name: post-release
on:
release:
types: [released]
workflow_dispatch:
inputs:
tag:
description: "Which tag to deploy as:"
required: true
permissions: {}
env:
# Assign commit authorship to official GitHub Actions bot when pushing to the `gh-pages` branch:
GIT_USER: "github-actions[bot]"
GIT_EMAIL: "41898282+github-actions[bot]@users.noreply.github.com"
jobs:
initialize:
name: initialize
runs-on: ubuntu-24.04
outputs:
version: ${{ env.VERSION }}
steps:
- name: Get the release version from the tag
run: |
if [[ -n "${{ github.event.inputs.tag }}" ]]; then
echo "Manual run against a tag; overriding actual tag in the environment..."
echo "VERSION=${{ github.event.inputs.tag }}" >> "$GITHUB_ENV"
else
echo "VERSION=${{ github.event.release.tag_name }}" >> "$GITHUB_ENV"
fi
- name: Make sure you're not on master/main/nightly
run: |
echo ${{ env.VERSION }}
if [[ ${{ env.VERSION }} == "master" || ${{ env.VERSION }} == "main" || ${{ env.VERSION }} == "nightly" ]]; then
exit 1
fi
docs:
needs: [initialize]
permissions:
pages: write
id-token: write
contents: write
uses: ./.github/workflows/docs.yml
secrets: inherit
with:
version: ${{ needs.initialize.outputs.version }}
alias: "stable"
chocolatey:
needs: [initialize]
runs-on: ubuntu-24.04
steps:
- name: Set release version
shell: bash
run: |
echo "RELEASE_VERSION=${{ needs.initialize.outputs.version }}" >> $GITHUB_ENV
- name: Validate release version
run: |
echo "Release version: ${{ env.RELEASE_VERSION }}"
- name: Trigger choco
run: |
curl -X POST https://api.github.com/repos/ClementTsang/choco-bottom/dispatches \
-H 'Accept: application/vnd.github.everest-preview+json' \
-u ${{ secrets.BOTTOM_PACKAGE_DEPLOYMENT }} \
--data '{ "event_type": "update", "client_payload": { "version": "'"$RELEASE_VERSION"'" } }'
publish-crate:
needs: [initialize, chocolatey, docs]
runs-on: ubuntu-24.04
environment: production
permissions:
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
fetch-depth: 0
- uses: rust-lang/crates-io-auth-action@bbd81622f20ce9e2dd9622e3218b975523e45bbe # v1.0.4
id: auth
- run: cargo publish
env:
CARGO_REGISTRY_TOKEN: ${{ steps.auth.outputs.token }}