From a872c19e16808fdf2f240120f7f0b3d3ad12f0fd Mon Sep 17 00:00:00 2001 From: cn-kali-team Date: Fri, 27 Sep 2024 16:23:22 +0800 Subject: [PATCH] update --- .github/workflows/default-release.yml | 58 +++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 .github/workflows/default-release.yml diff --git a/.github/workflows/default-release.yml b/.github/workflows/default-release.yml new file mode 100644 index 0000000..fdd2210 --- /dev/null +++ b/.github/workflows/default-release.yml @@ -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