Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 66 additions & 28 deletions .github/workflows/publish-release.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
on:
push:
tags:
- "v*" # Push events to matching `v*` version srings. e.g. v1.0, v20.15.10
- "v*" # Push events to matching `v*` version strings. e.g. v1.0, v20.15.10

name: Create and Publish Release

permissions: {}

jobs:
check-rust-ok:
runs-on: ubuntu-latest
permissions:
contents: read

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
with:
persist-credentials: false
submodules: recursive
- name: Build
run: cargo build --verbose
Expand All @@ -27,12 +32,13 @@
permissions:
contents: write
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
with:
persist-credentials: false
submodules: recursive
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
with:
python-version: '3.x'

Expand All @@ -50,24 +56,21 @@
# https://github.com/actions/checkout/issues/290
git fetch --tags --force
TAG_NAME=${GITHUB_REF/refs\/tags\//}
echo "$(git tag -l --format='%(contents)' $TAG_NAME)" > "${{ runner.temp }}/CHANGELOG.md"
echo "$(git tag -l --format='%(contents)' "$TAG_NAME")" > "${RUNNER_TEMP}/CHANGELOG.md"

- name: Create GitHub release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
body_path: "${{ runner.temp }}/CHANGELOG.md"
draft: false
prerelease: false
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create "${GITHUB_REF_NAME}" \
--title "${GITHUB_REF_NAME}" \
--notes-file "${RUNNER_TEMP}/CHANGELOG.md"

- name: Build a binary wheel and a source tarball
run: python3 -m build
- name: Store the distribution packages
uses: actions/upload-artifact@v4
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4
with:
name: python-package-distributions
path: dist/
Expand All @@ -84,27 +87,52 @@
name: pypi
url: https://pypi.org/p/axisregistry
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing
contents: read
id-token: write
steps:
- name: Download all the dists
uses: actions/download-artifact@v4
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4
with:
name: python-package-distributions
path: dist/
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
- name: Authenticate to Google Cloud
uses: google-github-actions/auth@7c6bc770dae815cd3e89ee6cdf493a5fab2cc093 # v3.0.0
with:
# repository-url: https://test.pypi.org/legacy/ # for testing purposes
verify-metadata: false # twine previously didn't verify metadata when uploading
workload_identity_provider: 'projects/305452601764/locations/global/workloadIdentityPools/builders/providers/github'
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@aa5489c8933f4cc7a4f7d45035b3b1440c9c10db # v3
- name: Stage distributions and trigger OSS Exit Gate release
env:
RUN_ID: ${{ github.run_id }}
RUN_ATTEMPT: ${{ github.run_attempt }}
run: |
set -euo pipefail
python3 -m venv .exit-gate-venv
.exit-gate-venv/bin/python -m pip install --upgrade pip twine keyrings.google-artifactregistry-auth
.exit-gate-venv/bin/python -m twine upload \
--repository-url https://us-python.pkg.dev/oss-exit-gate-prod/axisregistry--pypi/ \
--non-interactive \
--skip-existing \
dist/*
cat <<EOF > manifest.json
{
"publish_all": true
}
EOF
gcloud storage cp manifest.json \
"gs://oss-exit-gate-prod-projects-bucket/axisregistry/pypi/manifests/manifest-${RUN_ID}-${RUN_ATTEMPT}.json"

check-tagging:
name: >-
Check that the tag version and Cargo.toml version are the same
if: startsWith(github.ref, 'refs/tags/') # only check on tag pushes
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
with:
persist-credentials: false
submodules: recursive
- name: Check tag version and Cargo.toml version are same
run: |
Expand All @@ -124,23 +152,30 @@
- check-rust-ok
- check-tagging
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
with:
persist-credentials: false
submodules: recursive
- name: Publish crate 📦 to crates.io
run: cargo publish --token ${{ secrets.CARGO_REGISTRY_TOKEN }}

env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: cargo publish

Check notice on line 165 in .github/workflows/publish-release.yml

View workflow job for this annotation

GitHub Actions / zizmor-output

use-trusted-publishing

publish-release.yml:165: prefer trusted publishing for authentication: this command

upstream-subtree-merge:
name: >-
Update google/fonts with a new release of axisregistry
if: startsWith(github.ref, 'refs/tags/') # only merge into upstream on tag pushes
needs:
- build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout google/fonts
uses: actions/checkout@v3
uses: actions/checkout@a37ce9120846195fa4ece8f58b268e6043cb2f26 # v3 # zizmor: ignore[artipacked]
with:
repository: google/fonts
token: ${{ secrets.GOOGLE_FONTS_TOKEN }}
Expand All @@ -167,17 +202,20 @@
main

- name: Push branch to google/fonts
env:
BRANCH_NAME: ${{ steps.branch.outputs.branch_name }}
run: |
git push origin "${{ steps.branch.outputs.branch_name }}"
git push origin "${BRANCH_NAME}"

- name: Create Pull Request
env:
GH_TOKEN: ${{ secrets.GOOGLE_FONTS_TOKEN }}
BRANCH_NAME: ${{ steps.branch.outputs.branch_name }}
run: |
TAG_NAME="${GITHUB_REF#refs/tags/}"
gh pr create \
--repo google/fonts \
--base main \
--head "${{ steps.branch.outputs.branch_name }}" \
--head "${BRANCH_NAME}" \
--title "Update axisregistry to ${TAG_NAME}" \
--body "This PR updates the \`axisregistry\` subtree with the latest release ($TAG_NAME) from [googlefonts/axisregistry](https://github.com/googlefonts/axisregistry). **Important:** When merging, use the **\"Create a merge commit\"** button, **not** \"Squash and merge\", to preserve subtree history and avoid future merge conflicts."
--body "This PR updates the \`axisregistry\` subtree with the latest release ($TAG_NAME) from [googlefonts/axisregistry](https://github.com/googlefonts/axisregistry). **Important:** When merging, use the **\"Create a merge commit\"** button, **not** \"Squash and merge\", to preserve subtree history and avoid future merge conflicts."
Loading