Skip to content

feat(release): calc checksum #15

feat(release): calc checksum

feat(release): calc checksum #15

Workflow file for this run

name: release
on:
push:
tags:
- '*'
permissions:
contents: write
jobs:
build:
runs-on: ${{ matrix.platform.os }}
strategy:
matrix:
# cross compile to these targets.
# see https://qiita.com/okmt765/items/ad3cdfb5850e68edcef0
# see https://dzfrias.dev/blog/deploy-rust-cross-platform-github-actions
platform:
- os: ubuntu-latest
target: x86_64-unknown-linux-musl
- os: macos-latest
target: x86_64-apple-darwin
- os: macos-latest
target: aarch64-apple-darwin
steps:
- uses: actions/checkout@v4
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: ${{ matrix.platform.target }}
- uses: actions-rs/cargo@v1
with:
command: build
args: --release --target ${{ matrix.platform.target }}
- run: |
ARCHIVE_NAME=jsonwith-${{ github.ref_name }}-${{ matrix.platform.target }};
mkdir $ARCHIVE_NAME;
mv target/${{ matrix.platform.target }}/release/jsonwith $ARCHIVE_NAME/jsonwith;
tar -czf $ARCHIVE_NAME.tar.gz $ARCHIVE_NAME;
- uses: actions/upload-artifact@v4
with:
name: release-artifact
path: jsonwith-${{ github.ref_name }}-${{ matrix.platform.target }}.tar.gz
release:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/download-artifact@v4
with:
name: release-artifact
path: assets
- run: ls -la assets
- run: shasum -a 256 release/*.tar.gz > assets/checksums.txt
- run: |
cat <<'EOF' | envsubst > release.md
# jsonwith ${{ github.ref_name }}
## Installation
```bash
cargo install --git https://github.com/enuesaa/jsonwith --tag ${{ github.ref_name }}
```
EOF
- uses: softprops/action-gh-release@v1
with:
prerelease: true
body_path: release.md
files: assets/*