Add MUSL builds to GH Actions and fix Release event trigger (#810)

This commit is contained in:
Matthew Esposito 2023-06-03 14:19:20 -04:00 committed by GitHub
parent 97f0f69059
commit 0c74305617
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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