debug #76
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 Binary | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- build | |
watch: | |
types: [started] | |
jobs: | |
build: | |
if: github.event.repository.owner.id == github.event.sender.id | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [macos-14, macos-13] | |
# arch: [amd64, arm64] | |
arch: [amd64, arm64] | |
steps: | |
- name: Check Out Branch | |
uses: actions/checkout@master | |
with: | |
ref: build | |
- name: Linux Build | |
if: runner.os == 'Linux' | |
run: | | |
sudo apt install -y screen | |
mkdir ./artifact | |
arch=${{ matrix.arch }} | |
screen -dmS "pack_$arch" bash -c "nc -l 9999 > aria2c && chmod a+x aria2c && tar cvf $(pwd)/artifact/aria2c-linux-$arch.tar aria2c"; | |
HOST=$(ip -4 address|grep docker|grep -oE '([0-9]+\.){3}[0-9]+'|grep -v 255) | |
docker run --rm --privileged tonistiigi/binfmt:latest --install all | |
docker buildx create --use --name=multibulider --driver docker-container --driver-opt image=moby/buildkit:master | |
docker buildx use multibulider | |
docker buildx build --build-arg HOST=${HOST} --platform linux/${arch} -t aria2 . | |
- name: macOS Build | |
if: ${{ (matrix.os == 'macos-13' && matrix.arch == 'amd64') || (matrix.os == 'macos-14' && matrix.arch == 'arm64') }} | |
run: | | |
brew install autoconf automake pkg-config libtool; | |
brew unlink gettext || true | |
git checkout build | |
(cd /Users/runner/work/aria2;mkdir build;cd build; ln -s ../aria2/makerelease-osx-static.mk ./Makefile; make ARCH=${{ matrix.arch == 'amd64' && 'x86_64' || matrix.arch }} V=s) | |
strip /Users/runner/work/aria2/build/aria2-def/bin/aria2c | |
mkdir ./artifact/ | |
mv /Users/runner/work/aria2/build/aria2-def/bin/aria2c ./aria2c | |
tar cf ./artifact/aria2c-macos-${{ matrix.arch }}.tar aria2c | |
- name: upload macOS aria2c | |
if: ${{ (matrix.os == 'macos-13' && matrix.arch == 'amd64') || (matrix.os == 'macos-14' && matrix.arch == 'arm64') }} | |
uses: actions/upload-artifact@master | |
with: | |
name: aria2c-macos-${{ matrix.arch }} | |
path: ./artifact/ | |
- name: upload Linux aria2c | |
if: runner.os == 'Linux' | |
uses: actions/upload-artifact@master | |
with: | |
name: aria2c-linux-${{ matrix.arch }} | |
path: ./artifact/ | |
- name: SSH 连接到 Actions | |
uses: tofuliang/ssh2actions@main | |
if: ${{ failure() }} | |
env: | |
TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }} | |
TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }} | |
release: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set Build Date | |
run: echo "ReleaseVersion=`date +%Y%m%d`" >> $GITHUB_ENV | |
- name: Retrieve aria2c-macos-amd64 | |
uses: actions/download-artifact@master | |
with: | |
name: aria2c-macos-amd64 | |
path: ./artifact | |
- name: Retrieve aria2c-macos-arm64 | |
uses: actions/download-artifact@master | |
with: | |
name: aria2c-macos-arm64 | |
path: ./artifact | |
# - name: Retrieve aria2c-linux-amd64 | |
# uses: actions/download-artifact@master | |
# with: | |
# name: aria2c-linux-amd64 | |
# path: ./artifact | |
# - name: Retrieve aria2c-linux-arm64 | |
# uses: actions/download-artifact@master | |
# with: | |
# name: aria2c-linux-arm64 | |
# path: ./artifact | |
# - name: Retrieve aria2c-linux-ppc64le | |
# uses: actions/download-artifact@master | |
# with: | |
# name: aria2c-linux-ppc64le | |
# path: ./artifact | |
# - name: Retrieve aria2c-linux-s390x | |
# uses: actions/download-artifact@master | |
# with: | |
# name: aria2c-linux-s390x | |
# path: ./artifact | |
# - name: Retrieve aria2c-linux-386 | |
# uses: actions/download-artifact@master | |
# with: | |
# name: aria2c-linux-386 | |
# path: ./artifact | |
# - name: Retrieve aria2c-linux-arm | |
# uses: actions/download-artifact@master | |
# with: | |
# name: aria2c-linux-arm | |
# path: ./artifact | |
# - name: SSH 连接到 Actions | |
# uses: P3TERX/ssh2actions@main | |
# env: | |
# TELEGRAM_BOT_TOKEN: ${{ secrets.TELEGRAM_BOT_TOKEN }} | |
# TELEGRAM_CHAT_ID: ${{ secrets.TELEGRAM_CHAT_ID }} | |
- name: release | |
uses: marvinpinto/action-automatic-releases@latest | |
with: | |
repo_token: '${{ secrets.GITHUB_TOKEN }}' | |
prerelease: false | |
automatic_release_tag: ${{ env.ReleaseVersion }} | |
title: ${{ env.ReleaseVersion }} | |
files: ./artifact/* |