Files
bottom/.github/workflows/post_release.yml
T
Clement Tsang 99a84aaef2 ci: configure job to publish to crates.io (#2009)
* ci: configure job to publish to crates.io

* make this run last

* pin version
2026-04-04 23:23:32 -04:00

119 lines
3.6 KiB
YAML

# Actions to run after releasing a version, like:
# - Generating documentation via mkdocs
# - Notifying packaging repos
name: post-release
on:
release:
types: [published]
workflow_dispatch:
inputs:
tag:
description: "Which tag to deploy as:"
required: true
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]
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: Checkout repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
fetch-depth: 0
- uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.3.0
with:
python-version: 3.12
- name: Install Python dependencies
run: pip install -r docs/requirements.txt
- name: Configure git user and email
run: ./scripts/ci/configure_git.sh
- name: Build and deploy docs with mike as the latest stable branch
run: |
cd docs
mike deploy --push --update-aliases ${RELEASE_VERSION} stable
publish-gh-pages:
needs: [docs]
uses: ./.github/workflows/publish_github_pages.yml
secrets: inherit
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, publish-gh-pages]
runs-on: ubuntu-24.04
environment: production
permissions:
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
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 }}