Update release.yml #8
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: test | |
on: push | |
jobs: | |
build-release: | |
name: build-release | |
permissions: | |
contents: write | |
strategy: | |
matrix: | |
build: [linux-x86_64, macos-x86_64, windows-x86_64-gnu] | |
include: | |
- build: linux-x86_64 | |
os: ubuntu-latest | |
rust: nightly | |
target: x86_64-unknown-linux-gnu | |
- build: macos-x86_64 | |
os: macos-latest | |
rust: nightly | |
target: x86_64-apple-darwin | |
- build: windows-x86_64-gnu | |
os: windows-latest | |
rust: nightly-x86_64-gnu | |
target: x86_64-pc-windows-gnu | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v3 | |
# Run build | |
- name: install rustup | |
run: | | |
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs > rustup-init.sh | |
sh rustup-init.sh -y --default-toolchain none | |
rustup target add ${{ matrix.target }} | |
- uses: msys2/setup-msys2@v2 | |
if: matrix.rust == 'nightly-x86_64-gnu' | |
with: | |
msystem: MINGW64 | |
update: true | |
install: git mingw-w64-x86_64-toolchain mingw-w64-x86_64-cmake mingw-w64-x86_64-ninja git | |
- name: Put MSYS2_MinGW64 on PATH | |
shell: msys2 {0} | |
run: export PATH=D:/a/_temp/msys/msys64/mingw64/bin:$PATH | |
if: matrix.rust == 'nightly-x86_64-gnu' | |
- name: Add mingw64 to path for x86_64-gnu | |
# run: echo "C:\msys64\mingw64\bin" >> $GITHUB_PATH | |
run: echo "D:/a/_temp/msys/msys64/mingw64/bin">>$GITHUB_PATH | |
if: matrix.rust == 'nightly-x86_64-gnu' | |
shell: bash | |
- name: Build release binaries | |
uses: actions-rs/cargo@v1 | |
with: | |
command: build | |
args: --release --target ${{matrix.target}} --verbose | |
- name: build acts-cli | |
run: cargo build --release --target ${{matrix.target}} -p acts-cli --verbose | |
- name: Build archive | |
shell: bash | |
run: | | |
staging="${{ matrix.build }}" | |
mkdir -p "$staging" | |
cp {README.md,LICENSE,acts.conf} "$staging/" | |
if [ "${{ matrix.os }}" = "windows-latest" ]; then | |
cp target/${{matrix.target}}/release/acts-server.exe "$staging/" | |
cp target/${{matrix.target}}/release/acts-cli.exe "$staging/" | |
7z a "$staging.zip" "$staging" | |
echo "ASSET=$staging.zip" >> $GITHUB_ENV | |
else | |
cp target/${{matrix.target}}/release/acts-server "$staging/" | |
cp target/${{matrix.target}}/release/acts-cli "$staging/" | |
tar czf "$staging.tar.gz" "$staging" | |
echo "ASSET=$staging.tar.gz" >> $GITHUB_ENV | |
fi | |
- name: Upload Release Asset | |
uses: softprops/action-gh-release@v2 | |
if: startsWith(github.ref, 'refs/tags/') | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
files: ${{ env.ASSET }} |