release #37
Workflow file for this run
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 | |
permissions: | |
contents: write | |
pull-requests: write | |
on: | |
release: | |
types: [ published ] | |
env: | |
CARGO_INCREMENTAL: 0 | |
jobs: | |
github_build: | |
name: Build release binaries | |
strategy: | |
matrix: | |
include: | |
- target: x86_64-unknown-linux-gnu | |
os: ubuntu-latest | |
name: tuxmux-x86_64-unknown-linux-gnu.tar.gz | |
- target: aarch64-unknown-linux-gnu | |
os: ubuntu-latest | |
name: tuxmux-aarch64-unknown-linux-gnu.tar.gz | |
- target: x86_64-apple-darwin | |
os: macos-latest | |
name: tuxmux-x86_64-apple-darwin.tar.gz | |
- target: aarch64-apple-darwin | |
os: macos-latest | |
name: tuxmux-aarch64-apple-darwin.tar.gz | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Setup | Checkout | |
uses: actions/checkout@v4 | |
- name: Setup | Rust | |
uses: dtolnay/rust-toolchain@v1 | |
with: | |
toolchain: stable | |
targets: ${{matrix.target}} | |
- name: Setup | Install cross [Linux] | |
if: matrix.os == 'ubuntu-latest' | |
uses: taiki-e/install-action@v2 | |
with: | |
tool: cross | |
- name: Build | Build [Cargo] | |
if: matrix.os != 'ubuntu-latest' | |
run: cargo build --release --locked --target ${{ matrix.target }} | |
- name: Build | Build [Cross] | |
if: matrix.os == 'ubuntu-latest' | |
run: cross build --release --locked --target ${{ matrix.target }} | |
- name: Post | Prepare artifacts | |
run: | | |
RESULT="target-${{ matrix.target }}" | |
mkdir $RESULT | |
cp target/${{ matrix.target }}/release/tm $RESULT | |
cp -r target/${{ matrix.target }}/man $RESULT | |
cp -r target/${{ matrix.target }}/completions $RESULT | |
tar czvf ${{ matrix.name }} $RESULT | |
- name: Release | Upload artifacts | |
uses: actions/upload-artifact @v3 | |
with: | |
name: ${{ matrix.name }} | |
path: ${{ matrix.name }} | |
# --------------------------------------------------------------------------- | |
upload_artifacts: | |
name: Add build artifacts to release | |
needs: github_build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Setup | Artifacts | |
uses: actions/download-artifact@v3 | |
- name: Setup | Checksum | |
run: for file in tuxmux-*/tuxmux-*; do openssl dgst -sha256 -r "$file" | awk '{print $1}' > "${file}.sha256"; done | |
- name: Build | Publish release | |
run: gh release edit ${{ github.event.release.tag_name }} --repo=edeneast/tuxmux | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build | Add artifacts to release | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: tuxmux-*/tuxmux-* | |
tag_name: ${{ github.event.release.tag_name }} | |
# --------------------------------------------------------------------------- | |
publish_crate: | |
name: Publish cargo package | |
needs: github_build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Setup | Checkout | |
uses: actions/checkout@v4 | |
- name: Setup | Rust | |
uses: dtolnay/rust-toolchain@stable | |
- name: Setup | Nix | |
uses: cachix/install-nix-action@v23 | |
with: | |
extra_nix_config: | | |
experimental-features = nix-command flakes | |
access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} | |
- name: Build | Markdown readme | |
run: | | |
nix develop --command just markdown | |
git config user.name github-actions[bot] | |
git config user.email 41898282+github-actions[bot]@users.noreply.github.com | |
git add . | |
git commit -m "add readme.md" | |
- name: Build | Publish to crates.io | |
run: cargo publish --token ${{ secrets.CARGO_REGISTRY_TOKEN }} |