Bump actions/checkout from 3.1.0 to 4.1.7 #20
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Crate Release | |
on: | |
pull_request: | |
paths: | |
- .github/workflows/release-crate.yml | |
- Cargo.toml | |
- justfile | |
push: | |
tags: | |
- 'release/v[0-9]+.[0-9]+.[0-9]+' | |
permissions: | |
contents: write | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
timeout-minutes: 10 | |
container: docker://ghcr.io/linkerd/dev:v36-rust-musl | |
steps: | |
- name: Parse tag | |
id: parse-tag | |
shell: bash | |
run: | | |
ref="${{ github.ref }}" | |
if [[ "$ref" == refs/tags/release/* ]]; then | |
v="${ref#refs/tags/release/}" | |
echo "Crate version: $v" | |
echo version="$v" >> "$GITHUB_OUTPUT" | |
else | |
echo "Not a release version: $ref" | |
fi | |
# XXX dev:v36-rust container doesn't include libjq | |
- run: apt update && apt install -y --no-install-recommends jq | |
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 | |
- run: just fetch --locked | |
- name: Check crate version | |
if: steps.parse-tag.outputs.version | |
run: | | |
v=$(just crate-version) | |
echo "cargo.toml $v" | |
if [ "${v}" != '${{ steps.parse-tag.outputs.version }}' ]; then | |
echo "::error ::Crate version '${v} does' not match tag version '${{ steps.parse-tag.outputs.version }}'" | |
exit 1 | |
fi | |
# These are fairly quick so we don't bother running them in parallel. The | |
# `cargo fetch` time above far outweighs the build time. | |
- run: echo PKG_DIR="$(mktemp -d "$RUNNER_TEMP/pkg.XXX")" >> "$GITHUB_ENV" | |
- run: just profile=release target=x86_64-unknown-linux-musl package "$PKG_DIR" | |
- run: just profile=release target=aarch64-unknown-linux-musl package "$PKG_DIR" | |
- run: just profile=release target=armv7-unknown-linux-musleabihf package "$PKG_DIR" | |
- run: find "$PKG_DIR"/release -ls | |
- if: steps.parse-tag.outputs.version == '' | |
run: cargo publish --dry-run | |
- if: steps.parse-tag.outputs.version | |
run: cargo publish --token=${{ secrets.CRATESIO_TOKEN }} | |
- uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 | |
if: steps.parse-tag.outputs.version | |
with: | |
name: ${{ steps.parse-tag.outputs.version }} | |
files: ${{ env.PKG_DIR }}/release/* | |
generate_release_notes: true |