2022-03-14 05:48:29 +00:00
|
|
|
name: Release
|
2022-03-16 19:18:01 +00:00
|
|
|
|
2022-03-13 05:50:04 +00:00
|
|
|
on:
|
|
|
|
release:
|
|
|
|
types: [created]
|
2022-03-16 19:18:01 +00:00
|
|
|
|
|
|
|
permissions: read-all
|
|
|
|
|
2022-03-13 05:50:04 +00:00
|
|
|
jobs:
|
2022-03-14 05:48:29 +00:00
|
|
|
build-release:
|
|
|
|
name: build-release
|
2022-03-16 19:18:01 +00:00
|
|
|
permissions:
|
|
|
|
contents: write
|
2022-03-13 05:50:04 +00:00
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
2022-03-14 05:48:29 +00:00
|
|
|
build: [linux-musl, macos, win-msvc]
|
2022-03-13 05:50:04 +00:00
|
|
|
include:
|
2022-03-14 05:48:29 +00:00
|
|
|
- build: linux-musl
|
|
|
|
os: ubuntu-20.04
|
|
|
|
target: x86_64-unknown-linux-musl
|
|
|
|
- build: macos
|
|
|
|
os: macos-11
|
|
|
|
target: x86_64-apple-darwin
|
|
|
|
- build: win-msvc
|
|
|
|
os: windows-2022
|
|
|
|
target: x86_64-pc-windows-msvc
|
|
|
|
runs-on: ${{ matrix.os }}
|
2022-03-13 05:50:04 +00:00
|
|
|
steps:
|
2022-03-14 05:48:29 +00:00
|
|
|
- name: Checkout repository
|
2022-03-17 03:58:04 +00:00
|
|
|
uses: actions/checkout@a12a3943b4bdde767164f792f33f40b04645d846
|
2022-03-14 05:48:29 +00:00
|
|
|
- name: Install packages (Ubuntu)
|
|
|
|
if: matrix.os == 'ubuntu-20.04'
|
|
|
|
run: |
|
|
|
|
sudo apt-get update
|
|
|
|
sudo apt-get install -y --no-install-recommends xz-utils liblz4-tool musl-tools
|
|
|
|
- name: Install Rust
|
2022-03-17 15:58:22 +00:00
|
|
|
uses: actions-rs/toolchain@b2417cde72dcf67f306c0ae8e0828a81bf0b189f
|
2022-03-14 05:48:29 +00:00
|
|
|
with:
|
|
|
|
toolchain: stable
|
|
|
|
profile: minimal
|
|
|
|
override: true
|
|
|
|
target: ${{ matrix.target }}
|
|
|
|
- name: Build release binary
|
2022-03-17 03:58:04 +00:00
|
|
|
uses: actions-rs/cargo@ae10961054e4aa8b4aa7dffede299aaf087aa33b
|
2022-03-14 05:48:29 +00:00
|
|
|
with:
|
|
|
|
command: build
|
|
|
|
args: --target ${{ matrix.target }} --verbose --release
|
|
|
|
- name: Build archive
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
outdir="./target/${{ matrix.target }}/release"
|
|
|
|
staging="jj-${{ github.event.release.tag_name }}-${{ matrix.target }}"
|
|
|
|
mkdir -p "$staging"/complete
|
|
|
|
cp {README.md,LICENSE} "$staging/"
|
|
|
|
if [ "${{ matrix.os }}" = "windows-2022" ]; then
|
|
|
|
cp "target/${{ matrix.target }}/release/jj.exe" "$staging/"
|
|
|
|
cd "$staging"
|
|
|
|
7z a "../$staging.zip" .
|
|
|
|
echo "ASSET=$staging.zip" >> $GITHUB_ENV
|
|
|
|
else
|
|
|
|
cp "target/${{ matrix.target }}/release/jj" "$staging/"
|
|
|
|
tar czf "$staging.tar.gz" -C "$staging" .
|
|
|
|
echo "ASSET=$staging.tar.gz" >> $GITHUB_ENV
|
|
|
|
fi
|
|
|
|
- name: Upload release archive
|
2022-03-17 03:58:04 +00:00
|
|
|
uses: actions/upload-release-asset@e8f9f06c4b078e705bd2ea027f0926603fc9b4d5
|
2022-03-13 05:50:04 +00:00
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
2022-03-14 05:48:29 +00:00
|
|
|
with:
|
|
|
|
upload_url: ${{ github.event.release.upload_url }}
|
|
|
|
asset_path: ${{ env.ASSET }}
|
|
|
|
asset_name: ${{ env.ASSET }}
|
|
|
|
asset_content_type: application/octet-stream
|