mirror of
https://github.com/storytold/craft-common-actions.git
synced 2026-11-15 23:12:33 +00:00
Release: support automatic contributor snapshot refresh
This commit is contained in:
1 parent
2b3fb9dc05
commit
3cb27117d0
5 files changed
+246
No files matched your search
@@ -0,0 +1,50 @@
|
||||
name: Refresh release contributors
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
outputs:
|
||||
artifact-name:
|
||||
description: Contributor snapshot to pass to the release workflow
|
||||
value: ${{ jobs.refresh.outputs.artifact-name }}
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: read
|
||||
|
||||
jobs:
|
||||
refresh:
|
||||
runs-on: ubuntu-24.04
|
||||
timeout-minutes: 15
|
||||
outputs:
|
||||
artifact-name: release-contributors-${{ github.run_id }}-${{ github.run_attempt }}
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
with:
|
||||
fetch-depth: 0
|
||||
persist-credentials: false
|
||||
- name: Refresh contributor credits for this release commit
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
python3 scripts/refresh-contributors.py --repo "$GITHUB_REPOSITORY"
|
||||
python3 - <<'PY'
|
||||
import json
|
||||
import os
|
||||
from pathlib import Path
|
||||
|
||||
credits = json.loads(Path("contributors/contributors.json").read_text())
|
||||
if credits.get("head") != os.environ["GITHUB_SHA"]:
|
||||
raise SystemExit("Contributor snapshot does not match the release commit")
|
||||
if credits.get("repo") != os.environ["GITHUB_REPOSITORY"]:
|
||||
raise SystemExit("Contributor snapshot does not match the release repository")
|
||||
if not credits.get("contributors"):
|
||||
raise SystemExit("Contributor snapshot is empty")
|
||||
PY
|
||||
- name: Save the refreshed snapshot for all release builds
|
||||
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
||||
with:
|
||||
name: release-contributors-${{ github.run_id }}-${{ github.run_attempt }}
|
||||
path: contributors/contributors.json
|
||||
if-no-files-found: error
|
||||
retention-days: 7
|
||||
@@ -27,6 +27,11 @@ on:
|
||||
type: string
|
||||
required: false
|
||||
default: ""
|
||||
contributors-artifact:
|
||||
description: "Optional contributor snapshot artifact from refresh-contributors.yml in this workflow run; installed before every source build"
|
||||
type: string
|
||||
required: false
|
||||
default: ""
|
||||
has-web:
|
||||
description: "Whether to build the WebAssembly (wasm) release"
|
||||
type: boolean
|
||||
@@ -264,6 +269,12 @@ jobs:
|
||||
exit 1
|
||||
fi
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
- name: Load refreshed contributor credits
|
||||
if: inputs.contributors-artifact != ''
|
||||
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
|
||||
with:
|
||||
name: ${{ inputs.contributors-artifact }}
|
||||
path: contributors
|
||||
- name: Check out craft-fonts
|
||||
if: inputs.craft-fonts-ref != ''
|
||||
uses: storytold/craft-common-actions/actions/checkout-craft-fonts@main
|
||||
@@ -404,6 +415,12 @@ jobs:
|
||||
exit 1
|
||||
fi
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
- name: Load refreshed contributor credits
|
||||
if: inputs.contributors-artifact != ''
|
||||
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
|
||||
with:
|
||||
name: ${{ inputs.contributors-artifact }}
|
||||
path: contributors
|
||||
- name: Check out craft-fonts
|
||||
if: inputs.craft-fonts-ref != ''
|
||||
uses: storytold/craft-common-actions/actions/checkout-craft-fonts@main
|
||||
@@ -509,6 +526,12 @@ jobs:
|
||||
INPUT_VERSION: ${{ inputs.version }}
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
- name: Load refreshed contributor credits
|
||||
if: inputs.contributors-artifact != ''
|
||||
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
|
||||
with:
|
||||
name: ${{ inputs.contributors-artifact }}
|
||||
path: contributors
|
||||
- name: Check out craft-fonts
|
||||
if: inputs.craft-fonts-ref != ''
|
||||
uses: storytold/craft-common-actions/actions/checkout-craft-fonts@main
|
||||
@@ -771,6 +794,12 @@ jobs:
|
||||
;;
|
||||
esac
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
- name: Load refreshed contributor credits
|
||||
if: inputs.contributors-artifact != ''
|
||||
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
|
||||
with:
|
||||
name: ${{ inputs.contributors-artifact }}
|
||||
path: contributors
|
||||
- name: Check out craft-fonts
|
||||
if: inputs.craft-fonts-ref != ''
|
||||
uses: storytold/craft-common-actions/actions/checkout-craft-fonts@main
|
||||
@@ -1014,6 +1043,12 @@ jobs:
|
||||
INPUT_VERSION: ${{ inputs.version }}
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
- name: Load refreshed contributor credits
|
||||
if: inputs.contributors-artifact != ''
|
||||
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
|
||||
with:
|
||||
name: ${{ inputs.contributors-artifact }}
|
||||
path: contributors
|
||||
- uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8 # v1
|
||||
with:
|
||||
toolchain: stable
|
||||
@@ -1112,6 +1147,12 @@ jobs:
|
||||
INPUT_VERSION: ${{ inputs.version }}
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
- name: Load refreshed contributor credits
|
||||
if: inputs.contributors-artifact != ''
|
||||
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
|
||||
with:
|
||||
name: ${{ inputs.contributors-artifact }}
|
||||
path: contributors
|
||||
- name: Check out craft-fonts
|
||||
if: inputs.craft-fonts-ref != ''
|
||||
uses: storytold/craft-common-actions/actions/checkout-craft-fonts@main
|
||||
@@ -1183,6 +1224,12 @@ jobs:
|
||||
FIGCRAFT_BUILD_SHA: ${{ github.sha }}
|
||||
steps:
|
||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
||||
- name: Load refreshed contributor credits
|
||||
if: inputs.contributors-artifact != ''
|
||||
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
|
||||
with:
|
||||
name: ${{ inputs.contributors-artifact }}
|
||||
path: contributors
|
||||
- name: Check out craft-i18n
|
||||
uses: storytold/craft-common-actions/actions/checkout-craft-i18n@main
|
||||
- uses: dtolnay/rust-toolchain@683b588c487a69d01f6c6ddf40f036ff682cc2c8 # v1
|
||||
|
||||
@@ -5,6 +5,7 @@ on:
|
||||
paths:
|
||||
- .github/workflows/freebsd.yml
|
||||
- .github/workflows/release.yml
|
||||
- .github/workflows/refresh-contributors.yml
|
||||
- .github/workflows/gate.yml
|
||||
- actions/freebsd-cargo-cache/**
|
||||
- actions/checkout-craft-i18n/**
|
||||
@@ -17,6 +18,7 @@ on:
|
||||
paths:
|
||||
- .github/workflows/freebsd.yml
|
||||
- .github/workflows/release.yml
|
||||
- .github/workflows/refresh-contributors.yml
|
||||
- .github/workflows/gate.yml
|
||||
- actions/freebsd-cargo-cache/**
|
||||
- actions/checkout-craft-i18n/**
|
||||
|
||||
Reference in new issue
Block a user