Update build.yml

This commit is contained in:
klzgrad 2021-02-28 20:24:10 +08:00 committed by GitHub
parent 98502f0d3c
commit 0180cee4fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,8 +1,11 @@
on: on:
push: push:
branches: [master] branches: [master]
paths-ignore: [README.md]
release: release:
types: [published] types: [published]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs: jobs:
linux: linux:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -12,6 +15,7 @@ jobs:
arch: [x64, x86, arm64, arm] arch: [x64, x86, arm64, arm]
env: env:
EXTRA_FLAGS: 'target_cpu="${{ matrix.arch }}"' EXTRA_FLAGS: 'target_cpu="${{ matrix.arch }}"'
BUNDLE: 'naiveproxy-${{ github.event.release.tag_name }}-${{ github.job }}-${{ matrix.arch }}'
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- run: sudo apt update - run: sudo apt update
@ -23,19 +27,14 @@ jobs:
- run: ./build.sh - run: ./build.sh
working-directory: src working-directory: src
- run: ./tests/basic.sh src/out/Release/naive - run: ./tests/basic.sh src/out/Release/naive
- run: | - run: mkdir ${{ env.BUNDLE }} && cp src/out/Release/naive src/config.json LICENSE USAGE.txt ${{ env.BUNDLE }}
BUNDLE="naiveproxy-${{ github.event.release.tag_name }}-${{ github.job }}-${{ matrix.arch }}" - run: tar cJf ${{ env.BUNDLE }}.tar.xz ${{ env.BUNDLE }}
mkdir $BUNDLE
cp src/out/Release/naive src/config.json LICENSE USAGE.txt $BUNDLE
tar cJf $BUNDLE.tar.xz $BUNDLE
- uses: actions/upload-release-asset@v1 - uses: actions/upload-release-asset@v1
if: ${{ github.event_name == 'release' }} if: ${{ github.event_name == 'release' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with: with:
upload_url: ${{ github.event.release.upload_url }} upload_url: ${{ github.event.release.upload_url }}
asset_path: naiveproxy-${{ github.event.release.tag_name }}-${{ github.job }}-${{ matrix.arch }}.tar.xz asset_path: ${{ env.BUNDLE }}.tar.xz
asset_name: naiveproxy-${{ github.event.release.tag_name }}-${{ github.job }}-${{ matrix.arch }}.tar.xz asset_name: ${{ env.BUNDLE }}.tar.xz
asset_content_type: application/octet-stream asset_content_type: application/octet-stream
win: win:
runs-on: windows-latest runs-on: windows-latest
@ -48,6 +47,7 @@ jobs:
arch: [x64, x86, arm64] arch: [x64, x86, arm64]
env: env:
EXTRA_FLAGS: 'target_cpu="${{ matrix.arch }}"' EXTRA_FLAGS: 'target_cpu="${{ matrix.arch }}"'
BUNDLE: 'naiveproxy-${{ github.event.release.tag_name }}-${{ github.job }}-${{ matrix.arch }}'
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- run: cinst ninja - run: cinst ninja
@ -57,19 +57,14 @@ jobs:
working-directory: src working-directory: src
- run: ./tests/basic.sh src/out/Release/naive - run: ./tests/basic.sh src/out/Release/naive
if: ${{ matrix.arch != 'arm64' }} if: ${{ matrix.arch != 'arm64' }}
- run: | - run: mkdir ${{ env.BUNDLE }} && cp src/out/Release/naive.exe src/config.json LICENSE USAGE.txt ${{ env.BUNDLE }}
BUNDLE="naiveproxy-${{ github.event.release.tag_name }}-${{ github.job }}-${{ matrix.arch }}" - run: 7z a ${{ env.BUNDLE }}.zip ${{ env.BUNDLE }}
mkdir $BUNDLE
cp src/out/Release/naive.exe src/config.json LICENSE USAGE.txt $BUNDLE
7z a $BUILD_NAME.zip $BUILD_NAME
- uses: actions/upload-release-asset@v1 - uses: actions/upload-release-asset@v1
if: ${{ github.event_name == 'release' }} if: ${{ github.event_name == 'release' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with: with:
upload_url: ${{ github.event.release.upload_url }} upload_url: ${{ github.event.release.upload_url }}
asset_path: naiveproxy-${{ github.event.release.tag_name }}-${{ github.job }}-${{ matrix.arch }}.zip asset_path: ${{ env.BUNDLE }}.zip
asset_name: naiveproxy-${{ github.event.release.tag_name }}-${{ github.job }}-${{ matrix.arch }}.zip asset_name: ${{ env.BUNDLE }}.zip
asset_content_type: application/octet-stream asset_content_type: application/octet-stream
mac: mac:
runs-on: macos-latest runs-on: macos-latest
@ -79,6 +74,7 @@ jobs:
arch: [x64, arm64] arch: [x64, arm64]
env: env:
EXTRA_FLAGS: 'target_cpu="${{ matrix.arch }}"' EXTRA_FLAGS: 'target_cpu="${{ matrix.arch }}"'
BUNDLE: 'naiveproxy-${{ github.event.release.tag_name }}-${{ github.job }}-${{ matrix.arch }}'
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- run: brew install ninja - run: brew install ninja
@ -88,19 +84,14 @@ jobs:
working-directory: src working-directory: src
- run: ./tests/basic.sh src/out/Release/naive - run: ./tests/basic.sh src/out/Release/naive
if: ${{ matrix.arch != 'arm64' }} if: ${{ matrix.arch != 'arm64' }}
- run: | - run: mkdir ${{ env.BUNDLE }} && cp src/out/Release/naive src/config.json LICENSE USAGE.txt ${{ env.BUNDLE }}
BUNDLE="naiveproxy-${{ github.event.release.tag_name }}-${{ github.job }}-${{ matrix.arch }}" - run: tar cJf ${{ env.BUNDLE }}.tar.xz ${{ env.BUNDLE }}
mkdir $BUNDLE
cp src/out/Release/naive src/config.json LICENSE USAGE.txt $BUNDLE
tar cJf $BUNDLE.tar.xz $BUNDLE
- uses: actions/upload-release-asset@v1 - uses: actions/upload-release-asset@v1
if: ${{ github.event_name == 'release' }} if: ${{ github.event_name == 'release' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with: with:
upload_url: ${{ github.event.release.upload_url }} upload_url: ${{ github.event.release.upload_url }}
asset_path: naiveproxy-${{ github.event.release.tag_name }}-${{ github.job }}-${{ matrix.arch }}.tar.xz asset_path: ${{ env.BUNDLE }}.tar.xz
asset_name: naiveproxy-${{ github.event.release.tag_name }}-${{ github.job }}-${{ matrix.arch }}.tar.xz asset_name: ${{ env.BUNDLE }}.tar.xz
asset_content_type: application/octet-stream asset_content_type: application/octet-stream
openwrt: openwrt:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -136,6 +127,7 @@ jobs:
use_allocator="none" use_allocator_shim=false use_allocator="none" use_allocator_shim=false
custom_toolchain="//build/toolchain/linux:clang_${{ matrix.target_cpu }}_openwrt" custom_toolchain="//build/toolchain/linux:clang_${{ matrix.target_cpu }}_openwrt"
OPENWRT_FLAGS: 'arch=${{ matrix.arch }} release=19.07.7 gcc_ver=7.5.0 ${{ matrix.openwrt }}' OPENWRT_FLAGS: 'arch=${{ matrix.arch }} release=19.07.7 gcc_ver=7.5.0 ${{ matrix.openwrt }}'
BUNDLE: 'naiveproxy-${{ github.event.release.tag_name }}-${{ github.job }}-${{ matrix.arch }}'
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
- run: sudo apt update - run: sudo apt update
@ -147,17 +139,12 @@ jobs:
- run: ./build.sh - run: ./build.sh
working-directory: src working-directory: src
- run: ./tests/basic.sh src/out/Release/naive - run: ./tests/basic.sh src/out/Release/naive
- run: | - run: mkdir ${{ env.BUNDLE }} && cp src/out/Release/naive src/config.json LICENSE USAGE.txt ${{ env.BUNDLE }}
BUNDLE="naiveproxy-${{ github.event.release.tag_name }}-${{ github.job }}-${{ matrix.arch }}" - run: tar cJf ${{ env.BUNDLE }}.tar.xz ${{ env.BUNDLE }}
mkdir $BUNDLE
cp src/out/Release/naive src/config.json LICENSE USAGE.txt $BUNDLE
tar cJf $BUNDLE.tar.xz $BUNDLE
- uses: actions/upload-release-asset@v1 - uses: actions/upload-release-asset@v1
if: ${{ github.event_name == 'release' }} if: ${{ github.event_name == 'release' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with: with:
upload_url: ${{ github.event.release.upload_url }} upload_url: ${{ github.event.release.upload_url }}
asset_path: naiveproxy-${{ github.event.release.tag_name }}-${{ github.job }}-${{ matrix.arch }}.tar.xz asset_path: ${{ env.BUNDLE }}.tar.xz
asset_name: naiveproxy-${{ github.event.release.tag_name }}-${{ github.job }}-${{ matrix.arch }}.tar.xz asset_name: ${{ env.BUNDLE }}.tar.xz
asset_content_type: application/octet-stream asset_content_type: application/octet-stream