diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..942577e --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,60 @@ +name: Release + +permissions: + contents: write + +on: + push: + # Run on x.y.z tags. + tags: + - "**[0-9]+.[0-9]+.[0-9]+*" + # Allow manual triggering. + workflow_dispatch: + +jobs: + build: + strategy: + matrix: + include: + - os: ubuntu-22.04 + target: x86_64-unknown-linux-gnu + - os: ubuntu-22.04-arm + target: aarch64-unknown-linux-gnu + - os: macos-14 + target: aarch64-apple-darwin + + runs-on: ${{ matrix.os }} + + steps: + - uses: actions/checkout@v4 + - uses: dtolnay/rust-toolchain@stable + - uses: Swatinem/rust-cache@v2 + - name: Build & test & rename + run: | + mv .cargo/config-portable.toml .cargo/config.toml + cargo build --profile dist + cargo test --profile dist + + mkdir artifacts + mv target/dist/deacon artifacts/deacon-${{ matrix.target }} + + - uses: actions/upload-artifact@v4 + with: + name: build-${{ matrix.os }} + path: artifacts + + release: + needs: build + runs-on: ubuntu-latest + steps: + - uses: actions/download-artifact@v4 + with: + path: release_artifacts + + - name: Create GitHub Release + uses: softprops/action-gh-release@v2 + with: + files: release_artifacts/**/* + draft: true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index a604d2f..5a30b74 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,9 +1,10 @@ name: Tests on: push: - branches: [ main ] + branches: [main] pull_request: - branches: [ main ] + branches: [main] + workflow_dispatch: env: CARGO_TERM_COLOR: always jobs: @@ -19,12 +20,6 @@ jobs: - name: Install Rust toolchain uses: dtolnay/rust-toolchain@stable - name: Cache cargo registry - uses: actions/cache@v4 - with: - path: | - ~/.cargo/registry - ~/.cargo/git - target - key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + uses: Swatinem/rust-cache@v2 - name: Run tests - run: cargo test --verbose \ No newline at end of file + run: cargo test --verbose