Skip to content

chore(rust-port): release 0.1.4 (#105) #15

chore(rust-port): release 0.1.4 (#105)

chore(rust-port): release 0.1.4 (#105) #15

Workflow file for this run

name: Release
# Cuts real semver GitHub Releases for the `gddy` binary via release-please,
# then builds and attaches multi-platform archives to the release it creates.
#
# Targets `rust-port` directly (not `main`) — see release-please-config.json
# and .release-please-manifest.json for context on why. When `rust-port`
# eventually merges into `main`, repoint the `push` trigger and the action's
# `target-branch` input below; nothing else needs to change.
on:
push:
branches: [rust-port]
workflow_dispatch:
inputs:
publish_only:
description: "Skip release-please, run build+attach directly against the latest release (for retrying a failed publish)"
type: boolean
default: false
permissions:
contents: write
pull-requests: write
concurrency:
group: release
cancel-in-progress: false
jobs:
release-please:
name: Release Please
runs-on: ubuntu-latest
outputs:
releases_created: ${{ steps.release.outputs.releases_created }}
tag_name: ${{ steps.release.outputs['rust--tag_name'] }}
steps:
- uses: googleapis/release-please-action@45996ed1f6d02564a971a2fa1b5860e934307cf7 #v5.0.0
id: release
if: ${{ !(github.event_name == 'workflow_dispatch' && inputs.publish_only) }}
with:
config-file: release-please-config.json
manifest-file: .release-please-manifest.json
target-branch: rust-port
build:
name: Build ${{ matrix.target }}
needs: release-please
if: needs.release-please.outputs.releases_created == 'true' || (github.event_name == 'workflow_dispatch' && inputs.publish_only == true)
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
- target: aarch64-unknown-linux-gnu
os: ubuntu-latest
cross: true
- target: x86_64-apple-darwin
os: macos-latest
- target: aarch64-apple-darwin
os: macos-latest
- target: x86_64-pc-windows-msvc
os: windows-latest
defaults:
run:
working-directory: rust
steps:
- name: Checkout code
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@29eef336d9b2848a0b548edc03f92a220660cdb8 # stable
with:
targets: ${{ matrix.target }}
- name: Cache cargo
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: |
~/.cargo/registry
~/.cargo/git
rust/target
key: ${{ runner.os }}-${{ matrix.target }}-cargo-${{ hashFiles('rust/Cargo.lock') }}
restore-keys: ${{ runner.os }}-${{ matrix.target }}-cargo-
- name: Install cross
if: matrix.cross == true
run: cargo install cross --locked
- name: Build
shell: bash
run: |
if [ "${{ matrix.cross }}" = "true" ]; then
cross build --release --target ${{ matrix.target }}
else
cargo build --release --target ${{ matrix.target }}
fi
- name: Package gddy
shell: bash
run: |
TARGET="${{ matrix.target }}"
ARCHIVE="gddy-${TARGET}"
mkdir -p staging
if [[ "${{ matrix.os }}" == "windows-latest" ]]; then
cp "target/${TARGET}/release/gddy.exe" "staging/gddy.exe"
(cd staging && 7z a "../${ARCHIVE}.zip" gddy.exe)
echo "ASSET=rust/${ARCHIVE}.zip" >> "$GITHUB_ENV"
else
cp "target/${TARGET}/release/gddy" "staging/gddy"
chmod 755 "staging/gddy"
tar -czf "${ARCHIVE}.tar.gz" -C staging gddy
echo "ASSET=rust/${ARCHIVE}.tar.gz" >> "$GITHUB_ENV"
fi
- name: Upload artifact
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: ${{ matrix.target }}
path: ${{ env.ASSET }}
attach:
name: Attach release assets
needs: [release-please, build]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
- name: Download artifacts
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
path: dist
merge-multiple: true
- name: Generate checksums
run: |
cd dist
sha256sum gddy-*.tar.gz gddy-*.zip > gddy-checksums-sha256.txt
- name: Attach assets to the release-please release
env:
GH_TOKEN: ${{ github.token }}
run: |
TAG="${{ needs.release-please.outputs.tag_name }}"
if [ -z "$TAG" ]; then
TAG="$(gh release list --limit 1 --json tagName --jq '.[0].tagName')"
fi
gh release upload "$TAG" \
dist/gddy-*.tar.gz \
dist/gddy-*.zip \
dist/gddy-checksums-sha256.txt \
install.sh \
install.ps1 \
--clobber