-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e960c87
commit a872c19
Showing
1 changed file
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# The way this works is the following: | ||
# | ||
# The create-release job runs purely to initialize the GitHub release itself | ||
# and to output upload_url for the following job. | ||
# | ||
# The build-release job runs only once create-release is finished. It gets the | ||
# release upload URL from create-release job outputs, then builds the release | ||
# executables for each supported platform and attaches them as release assets | ||
# to the previously created release. | ||
# | ||
# The key here is that we create the release only once. | ||
# | ||
# Reference: | ||
# https://eugene-babichenko.github.io/blog/2020/05/09/github-actions-cross-platform-auto-releases/ | ||
|
||
name: default-release | ||
on: | ||
workflow_call: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build-release: | ||
name: build-release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 1 | ||
- name: Cache | ||
uses: Swatinem/rust-cache@v1 | ||
- name: Install packages (Ubuntu) | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y gcc-multilib xz-utils liblz4-tool libc6-dev libssl-dev musl-tools pkg-config patchelf | ||
sudo apt-get install -y gcc-aarch64-linux-gnu gcc-arm-linux-gnueabihf | ||
- name: Install Rust | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: stable | ||
profile: minimal | ||
override: true | ||
target: x86_64-unknown-linux-musl | ||
- name: Build release binary | ||
run: cargo install --git https://github.com/getzola/zola.git --features=indexing-zh | ||
- name: Build archive | ||
shell: bash | ||
run: | | ||
bin_file="~/.cargo/bin/zola" | ||
echo "BIN_FILE=$bin_file" >> $GITHUB_ENV | ||
- name: Upload binary to release | ||
uses: svenstaro/upload-release-action@v1-release | ||
with: | ||
repo_token: ${{ secrets.GITHUB_TOKEN }} | ||
file: ${{ env.BIN_FILE }} | ||
asset_name: zola | ||
tag: default | ||
overwrite: true |