Build and Release #298
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
name: 'Build and Release' | |
on: | |
push: | |
branches: | |
- "*" | |
pull_request: | |
branches: | |
- "*" | |
release: | |
types: | |
- released | |
schedule: | |
- cron: "0 0 * * 6" | |
jobs: | |
create-prerelease: | |
name: Create Prerelease | |
if: github.event_name == 'push' || github.event_name == 'schedule' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set current date as env variable | |
run: echo "NOW=$(date --utc)" >> $GITHUB_ENV | |
- uses: dev-drprasad/[email protected] | |
with: | |
delete_release: true | |
tag_name: continuous | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create Prerelease Tag | |
id: create_prerelease_tag | |
uses: softprops/action-gh-release@v1 | |
with: | |
prerelease: true | |
draft: false | |
tag_name: continuous | |
name: Continuous build | |
body: | | |
Building time: ${{ env.NOW }} | |
- - - | |
static-build: | |
runs-on: ubuntu-latest | |
container: "abcfy2/muslcc-toolchain-ubuntu:${{ matrix.cross_host }}" | |
strategy: | |
fail-fast: false | |
matrix: | |
cross_host: | |
- arm-linux-musleabi | |
- aarch64-linux-musl | |
- mips-linux-musl | |
- mipsel-linux-musl | |
- mips64-linux-musl | |
- x86_64-linux-musl | |
- x86_64-w64-mingw32 | |
- i686-w64-mingw32 | |
use_libressl: [0, 1] | |
exclude: | |
- cross_host: x86_64-w64-mingw32 | |
use_libressl: 1 | |
- cross_host: i686-w64-mingw32 | |
use_libressl: 1 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- uses: actions/cache@v3 | |
id: cache | |
with: | |
path: downloads/ | |
key: build-cache-${{ matrix.cross_host }}-${{ github.sha }} | |
restore-keys: | | |
build-cache-${{ matrix.cross_host }}- | |
- name: compile | |
env: | |
CROSS_HOST: "${{ matrix.cross_host }}" | |
USE_LIBRESSL: "${{ matrix.use_libressl }}" | |
run: | | |
if [ "${GITHUB_EVENT_NAME}" = release ]; then | |
export ARIA2_VER="${GITHUB_REF#refs/*/}" | |
echo "ARIA2_VER=${ARIA2_VER}" >> $GITHUB_ENV | |
fi | |
"${GITHUB_WORKSPACE}/build.sh" | |
- name: zip archiving | |
env: | |
CROSS_HOST: "${{ matrix.cross_host }}" | |
USE_LIBRESSL: "${{ matrix.use_libressl }}" | |
run: | | |
apt install -y zip | |
if [ x"${USE_LIBRESSL}" = x"1" ]; then | |
ARCHIVE_NAME="aria2-${CROSS_HOST}_libressl_static.zip" | |
else | |
ARCHIVE_NAME="aria2-${CROSS_HOST}_static.zip" | |
fi | |
echo "ARCHIVE_NAME=${ARCHIVE_NAME}" >> $GITHUB_ENV | |
zip -j9v "/tmp/${ARCHIVE_NAME}" "${GITHUB_WORKSPACE}"/aria2c* | |
- name: Prerelease assets | |
if: github.event_name == 'push' || github.event_name == 'schedule' | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: /tmp/${{ env.ARCHIVE_NAME }} | |
prerelease: true | |
draft: false | |
tag_name: continuous | |
name: Continuous build | |
body_path: "${{ github.workspace }}/build_info.md" | |
append_body: true | |
- name: Upload Github Assets | |
if: startsWith(github.ref, 'refs/tags/') | |
uses: softprops/action-gh-release@v1 | |
with: | |
files: /tmp/${{ env.ARCHIVE_NAME }} | |
name: aria2 ${{ env.ARIA2_VER }} static release | |
body_path: "${{ github.workspace }}/build_info.md" | |
append_body: true |