mirror of
https://github.com/martinvonz/jj.git
synced 2025-01-18 02:04:19 +00:00
github: new attempt at setting up automated release builds (#73)
My attempt at using rust-build/rust-build.action for release builds (frombf21e65c5d
) initially seemed promising. However, the produced musl binary build segfaulted on my Debian machine. I don't know about the Mac and Windows binaries. I then tried switching to building with a vendored OpenSSL (cac93e2793
), but then the build started failing (https://github.com/martinvonz/jj/actions/runs/1978730621). I couldn't figure out why it failed, so I decided to do the build in a more manual way (without rust-build/rust-build.action), based on https://github.com/gitext-rs/git-stack/blob/main/.github/workflows/post-release.yml (thanks to @epage for the example and to @arxanas for the link). I could simplify it a bit because I'm currently doing the releases via the GitHub UI (epage's original triggers the release when a tag has been pushed, IIUC). Let's hope that it works this time.
This commit is contained in:
parent
a8f334dc35
commit
73a0f72ffa
1 changed files with 57 additions and 18 deletions
75
.github/workflows/release.yml
vendored
75
.github/workflows/release.yml
vendored
|
@ -1,29 +1,68 @@
|
||||||
# .github/workflows/release.yml
|
name: Release
|
||||||
|
|
||||||
on:
|
on:
|
||||||
release:
|
release:
|
||||||
types: [created]
|
types: [created]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
release:
|
build-release:
|
||||||
name: release ${{ matrix.target }}
|
name: build-release
|
||||||
runs-on: ubuntu-latest
|
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
|
build: [linux-musl, macos, win-msvc]
|
||||||
include:
|
include:
|
||||||
- target: x86_64-pc-windows-gnu
|
- build: linux-musl
|
||||||
archive: zip
|
os: ubuntu-20.04
|
||||||
- target: x86_64-unknown-linux-musl
|
target: x86_64-unknown-linux-musl
|
||||||
archive: tar.gz tar.xz
|
- build: macos
|
||||||
- target: x86_64-apple-darwin
|
os: macos-11
|
||||||
archive: zip
|
target: x86_64-apple-darwin
|
||||||
|
- build: win-msvc
|
||||||
|
os: windows-2022
|
||||||
|
target: x86_64-pc-windows-msvc
|
||||||
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@master
|
- name: Checkout repository
|
||||||
- name: Compile and release
|
uses: actions/checkout@v3
|
||||||
uses: rust-build/rust-build.action@latest
|
- 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
|
||||||
|
uses: actions-rs/toolchain@v1
|
||||||
|
with:
|
||||||
|
toolchain: stable
|
||||||
|
profile: minimal
|
||||||
|
override: true
|
||||||
|
target: ${{ matrix.target }}
|
||||||
|
- name: Build release binary
|
||||||
|
uses: actions-rs/cargo@v1
|
||||||
|
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
|
||||||
|
uses: actions/upload-release-asset@v1.0.1
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
RUSTTARGET: ${{ matrix.target }}
|
with:
|
||||||
EXTRA_FILES: "README.md LICENSE"
|
upload_url: ${{ github.event.release.upload_url }}
|
||||||
ARCHIVE_TYPES: ${{ matrix.archive }}
|
asset_path: ${{ env.ASSET }}
|
||||||
|
asset_name: ${{ env.ASSET }}
|
||||||
|
asset_content_type: application/octet-stream
|
||||||
|
|
Loading…
Reference in a new issue