Skip to content

Commit

Permalink
ci(bin): setup binary release (#77)
Browse files Browse the repository at this point in the history
Setup a GitHub workflow that will generate binaries and push them to the
corresponding GitHub release created by release-plz.

Resolves #74
  • Loading branch information
johnallen3d authored Sep 4, 2023
1 parent e6aa8f5 commit a3082bd
Show file tree
Hide file tree
Showing 5 changed files with 81 additions and 26 deletions.
69 changes: 69 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: cd

permissions:
contents: write

on:
release:
types: [published]

env:
CARGO_INCREMENTAL: 0
CARGO_NET_GIT_FETCH_WITH_CLI: true
CARGO_NET_RETRY: 10
CARGO_TERM_COLOR: always
RUST_BACKTRACE: 1
RUSTFLAGS: -D warnings
RUSTUP_MAX_RETRIES: 10

defaults:
run:
shell: bash

jobs:
upload-assets:
name: ${{ matrix.target }}
if: github.repository_owner == 'johnallen3d' && startsWith(github.event.release.name, 'v')
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- target: aarch64-unknown-linux-gnu
os: ubuntu-22.04
- target: aarch64-unknown-linux-musl
os: ubuntu-22.04
- target: aarch64-apple-darwin
os: macos-12
- target: aarch64-pc-windows-msvc
os: windows-2022
- target: x86_64-unknown-linux-gnu
os: ubuntu-22.04
- target: x86_64-unknown-linux-musl
os: ubuntu-22.04
- target: x86_64-apple-darwin
os: macos-12
- target: x86_64-pc-windows-msvc
os: windows-2022
- target: x86_64-unknown-freebsd
os: ubuntu-22.04
- target: universal-apple-darwin
os: macos-12
timeout-minutes: 60
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- uses: taiki-e/setup-cross-toolchain-action@v1
with:
target: ${{ matrix.target }}
if: startsWith(matrix.os, 'ubuntu') && !contains(matrix.target, '-musl')
- uses: taiki-e/install-action@cross
if: contains(matrix.target, '-musl')
- run: echo "RUSTFLAGS=${RUSTFLAGS} -C target-feature=+crt-static" >> "${GITHUB_ENV}"
if: endsWith(matrix.target, 'windows-msvc')
- uses: taiki-e/upload-rust-binary-action@v1
with:
bin: conditions
target: ${{ matrix.target }}
token: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CI
name: ci

on: [push]

Expand Down
13 changes: 11 additions & 2 deletions .github/workflows/release-plz.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,23 @@ jobs:
name: Release-plz
runs-on: ubuntu-latest
steps:
# Generating a GitHub token, so that PRs and tags created by
# the release-plz-action can trigger actions workflows.
- name: Generate GitHub token
uses: tibdex/github-app-token@v1
id: generate-token
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}
- name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ steps.generate-token.outputs.token }}
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
- name: Run release-plz
uses: MarcoIeni/release-plz-action@v0.5
uses: MarcoIeni/release-plz-action@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }}
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
2 changes: 0 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ categories = ["command-line-utilities"]
readme = "README.md"

license = "MIT"
license-file = "LICENSE.md"


[dependencies]
clap = { version = "4.4.2", features = ["derive"] }
Expand Down
21 changes: 0 additions & 21 deletions LICENSE.md

This file was deleted.

0 comments on commit a3082bd

Please sign in to comment.