From 0c743056173f6a5a58e9172d54476ed2b532027e Mon Sep 17 00:00:00 2001 From: Matthew Esposito Date: Sat, 3 Jun 2023 14:19:20 -0400 Subject: [PATCH] Add MUSL builds to GH Actions and fix Release event trigger (#810) --- .github/workflows/main-rust.yml | 52 +++++++++++++++++++++++---------- 1 file changed, 37 insertions(+), 15 deletions(-) diff --git a/.github/workflows/main-rust.yml b/.github/workflows/main-rust.yml index 13f5e33..d6486c8 100644 --- a/.github/workflows/main-rust.yml +++ b/.github/workflows/main-rust.yml @@ -31,32 +31,51 @@ jobs: with: toolchain: stable + # Building actions - name: Build run: cargo build --release - - name: Publish to crates.io - if: github.event_name == 'release' - run: cargo publish --no-verify --token ${{ secrets.CARGO_REGISTRY_TOKEN }} - - - uses: actions/upload-artifact@v3 - name: Upload a Build Artifact - with: - name: libreddit - path: target/release/libreddit - - - name: Versions - id: version - run: echo "VERSION=$(cargo metadata --format-version 1 --no-deps | jq .packages[0].version -r | sed 's/^/v/')" >> "$GITHUB_OUTPUT" - - name: Calculate SHA512 checksum run: sha512sum target/release/libreddit > libreddit.sha512 - name: Calculate SHA256 checksum run: sha256sum target/release/libreddit > libreddit.sha256 + + - name: Build MUSL + run: cargo build --release --target x86_64-unknown-linux-musl + + - name: Calculate MUSL SHA512 checksum + run: sha512sum target/x86_64-unknown-linux-musl/release/libreddit > libreddit-musl.sha512 + + - name: Calculate MUSL SHA256 checksum + run: sha256sum target/x86_64-unknown-linux-musl/release/libreddit > libreddit-musl.sha256 + + - name: Move MUSL binary + run: mv target/x86_64-unknown-linux-musl/release/libreddit target/x86_64-unknown-linux-musl/release/libreddit-musl + + - uses: actions/upload-artifact@v3 + name: Upload a Build Artifact + with: + name: libreddit + path: | + target/release/libreddit + target/x86_64-unknown-linux-musl/release/libreddit-musl + *.sha512 + *.sha256 + - name: Versions + id: version + run: echo "VERSION=$(cargo metadata --format-version 1 --no-deps | jq .packages[0].version -r | sed 's/^/v/')" >> "$GITHUB_OUTPUT" + + # Publishing actions + + - name: Publish to crates.io + if: github.event_name == 'release' + run: cargo publish --no-verify --token ${{ secrets.CARGO_REGISTRY_TOKEN }} + - name: Release uses: softprops/action-gh-release@v1 - if: github.base_ref != 'master' + if: github.base_ref != 'master' && github.event_name == 'release' with: tag_name: ${{ steps.version.outputs.VERSION }} name: ${{ steps.version.outputs.VERSION }} - ${{ github.event.head_commit.message }} @@ -65,6 +84,9 @@ jobs: target/release/libreddit libreddit.sha512 libreddit.sha256 + target/x86_64-unknown-linux-musl/release/libreddit-musl + libreddit-musl.sha512 + libreddit-musl.sha256 body: | - ${{ github.event.head_commit.message }} ${{ github.sha }} generate_release_notes: true