CD #576
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: CD | |
run-name: ${{ inputs.reason }} | |
on: | |
push: | |
tags: | |
- v* | |
workflow_run: | |
workflows: | |
- CI | |
types: | |
- completed | |
workflow_dispatch: | |
inputs: | |
reason: | |
description: Dispatch reason | |
required: true | |
type: string | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
upload-artifact: | |
name: Build and Upload Binary | |
strategy: | |
matrix: | |
os: | |
- ubuntu-latest | |
- macos-latest | |
- windows-latest | |
runs-on: ${{ matrix.os }} | |
permissions: | |
id-token: write | |
attestations: write | |
if: github.event_name != 'workflow_run' || (github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success') | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Set-up or update Rust toolchain | |
run: rustup toolchain install stable --profile default | |
- name: Set-up Rust cache | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.cargo/bin | |
~/.cargo/registry/index | |
~/.cargo/registry/cache | |
~/.cargo/git/db | |
target/ | |
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | |
- name: Build project | |
run: cargo build --verbose --release | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: lure-${{ runner.os }} | |
path: target/release/lure${{ runner.os == 'Windows' && '.exe' || '' }} | |
- name: Generate artifact attestation | |
uses: actions/attest-build-provenance@v1 | |
with: | |
subject-name: lure-${{ runner.os }} | |
subject-path: target/release/lure${{ runner.os == 'Windows' && '.exe' || '' }} | |
push-container-image: | |
name: Push Container Image | |
uses: ./.github/workflows/docker-push.yaml | |
permissions: | |
attestations: write | |
contents: read | |
id-token: write | |
packages: write | |
with: | |
image-name: lure |