Skip to content

Commit

Permalink
Add workflow to build distribution packages on release
Browse files Browse the repository at this point in the history
  • Loading branch information
hisbaan committed Feb 6, 2024
1 parent d477409 commit 8a74549
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 24 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/build-package.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: build-package
on:
workflow_dispatch:
release:
types: [published]
branches: [main]
env:
CARGO_TERM_COLOR: always
RUSTUP_TOOLCHAIN: stable
CARGO_TARGET_DIR: target
jobs:
build:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build
run: cargo build --locked --release
- name: Strip binary
run: strip target/release/dym
- name: Move the binary
run: cp target/release/dym .
- name: Create TAR package
run: tar -czvf dym-$(target/release/dym --version | cut -d ' ' -f 2)-x86_64-${{ matrix.os == 'macos-latest' && 'apple-darwin' || 'linux-gnu' }}.tar.gz completions docs man dym
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: dym-$(target/release/dym --version | cut -d ' ' -f 2)-x86_64-${{ matrix.os == 'macos-latest' && 'apple-darwin' || 'linux-gnu' }}.tar.gz
41 changes: 17 additions & 24 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,27 @@
name: tests

on:
push:
branches: [ main ]
branches: [main]
pull_request:
branches: [ main ]

branches: [main]
env:
CARGO_TERM_COLOR: always

jobs:
build:

runs-on: macos-latest

steps:
- uses: actions/checkout@v3

- name: Cache build artifacts
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose
- uses: actions/checkout@v3
- name: Cache build artifacts
uses: actions/cache@v3
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Build
run: cargo build --verbose
- name: Run tests
run: cargo test --verbose

0 comments on commit 8a74549

Please sign in to comment.