release #13
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: release | |
on: | |
push: | |
tags: | |
- v[0-9]+.[0-9]+.[0-9]+ | |
workflow_dispatch: | |
inputs: | |
tag: | |
description: The existing tag to publish to FlakeHub | |
type: string | |
required: true | |
jobs: | |
create_release: | |
name: create_release | |
runs-on: ubuntu-latest | |
steps: | |
- name: Create release | |
uses: softprops/action-gh-release@v1 | |
with: | |
body: "[CHANGELOG.md](https://github.com/nix-community/nurl/blob/main/CHANGELOG.md)" | |
release: | |
name: release | |
needs: create_release | |
runs-on: ${{ matrix.os }} | |
if: github.event_name != 'workflow_dispatch' | |
strategy: | |
matrix: | |
include: | |
- target: x86_64-apple-darwin | |
os: macos-latest | |
- target: x86_64-unknown-linux-gnu | |
os: ubuntu-latest | |
- target: x86_64-unknown-linux-musl | |
os: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Install dependencies (musl) | |
if: contains(matrix.target, 'musl') | |
run: | | |
sudo apt update | |
sudo apt install musl-tools | |
- name: Cargo build | |
run: | | |
rustup toolchain install nightly --profile minimal -t ${{ matrix.target }} | |
cargo +nightly build --release --target ${{ matrix.target }} | |
env: | |
RUSTFLAGS: -C strip=symbols | |
- name: Upload asset | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ github.token }} | |
tag: ${{ github.ref }} | |
file: target/${{ matrix.target }}/release/nurl | |
asset_name: nurl-${{ matrix.target }} | |
artifacts: | |
name: artifacts | |
needs: create_release | |
runs-on: ubuntu-latest | |
if: github.event_name != 'workflow_dispatch' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Cargo build | |
run: | | |
rustup toolchain install nightly --profile minimal | |
cargo +nightly build | |
env: | |
GEN_ARTIFACTS: artifacts | |
- name: Rename generated artifacts | |
run: | | |
mv artifacts/{_,}nurl.ps1 | |
mv artifacts/{_nurl,nurl.zsh} | |
- name: Upload artifacts | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ github.token }} | |
tag: ${{ github.ref }} | |
file: artifacts/* | |
file_glob: true | |
flakehub: | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
contents: read | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: ${{ inputs.tag != null && format('refs/tags/{0}', inputs.tag) || '' }} | |
- uses: DeterminateSystems/nix-installer-action@v4 | |
- uses: DeterminateSystems/flakehub-push@v3 | |
with: | |
visibility: public | |
tag: ${{ inputs.tag }} |