Skip to content

Commit

Permalink
ci: permit specifying old git refs
Browse files Browse the repository at this point in the history
  • Loading branch information
MilesCranmer committed Dec 24, 2024
1 parent f8eaba9 commit f164619
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ on:
type: boolean
default: false
required: false
git_ref:
description: 'Git ref (commit SHA, tag, or branch) to run workflow on'
type: string
required: false
default: ''
concurrency:
# Skip intermediate builds: always.
# Cancel intermediate builds: only if it is a pull request build.
Expand Down Expand Up @@ -45,6 +50,8 @@ jobs:
HAS_COVERALLS_ACCESS: ${{ secrets.COVERALLS_REPO_TOKEN != '' }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.git_ref || github.ref }}
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ matrix.rust-version }}
Expand Down Expand Up @@ -77,6 +84,8 @@ jobs:
- macOS-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.git_ref || github.ref }}
- name: Check Nix flake inputs
uses: DeterminateSystems/flake-checker-action@v4
- name: Install Nix
Expand Down Expand Up @@ -111,6 +120,7 @@ jobs:

steps:
- uses: googleapis/release-please-action@v4
if: ${{ !github.event.inputs.git_ref }}
id: release
with:
release-type: rust
Expand All @@ -120,10 +130,11 @@ jobs:
name: Publish to crates.io
runs-on: ubuntu-latest
needs: release-please
if: needs.release-please.outputs.created || github.event.inputs.force_publish == 'true'

if: needs.release-please.outputs.created || (github.event.inputs.force_publish == 'true' && !github.event.inputs.git_ref && startsWith(github.event.inputs.git_ref, 'v'))
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.git_ref || github.ref }}
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
Expand All @@ -137,7 +148,7 @@ jobs:
needs:
- release-please
- publish
if: needs.release-please.outputs.created || github.event.inputs.force_publish == 'true'
if: needs.release-please.outputs.created || (github.event.inputs.force_publish == 'true' && !github.event.inputs.git_ref && startsWith(github.event.inputs.git_ref, 'v'))
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -240,6 +251,8 @@ jobs:
- stable
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.git_ref || github.ref }}
- uses: Swatinem/rust-cache@v2
- name: Install musl-tools on Linux
run: sudo apt-get update --yes && sudo apt-get install --yes musl-tools
Expand Down Expand Up @@ -275,6 +288,6 @@ jobs:
if: matrix.toolchain == 'stable'
with:
file_glob: true
tag: ${{ needs.release-please.outputs.tag_name }}
tag: ${{ (startsWith(github.event.inputs.git_ref, 'v') && github.event.inputs.git_ref) || needs.release-please.outputs.tag_name }}
file: ${{ matrix.platform.name }}
overwrite: true

0 comments on commit f164619

Please sign in to comment.