Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- name: Release
- on:
- push:
- tags:
- - "v*"
- jobs:
- build:
- name: Build ${{ matrix.target }}
- runs-on: ${{ matrix.os }}
- strategy:
- fail-fast: false
- matrix:
- include:
- - os: ubuntu-latest
- target: x86_64-unknown-linux-gnu
- name: linux-x86_64
- - os: ubuntu-latest
- target: x86_64-unknown-linux-musl
- name: linux-musl-x86_64
- - os: macos-latest
- target: x86_64-apple-darwin
- name: darwin-x86_64
- - os: macos-latest
- target: aarch64-apple-darwin
- name: darwin-aarch64
- - os: windows-latest
- target: x86_64-pc-windows-msvc
- name: windows-x86_64
- steps:
- - uses: actions/checkout@v4
- - name: Install Rust
- uses: dtolnay/rust-toolchain@stable
- with:
- targets: ${{ matrix.target }}
- - name: Install dependencies (Linux)
- if: runner.os == 'Linux'
- run: |
- sudo apt-get update
- sudo apt-get install -y libasound2-dev libudev-dev pkg-config libx11-dev libwayland-dev libxkbcommon-dev
- - name: Install target (Linux MUSL)
- if: matrix.target == 'x86_64-unknown-linux-musl'
- run: |
- rustup target add x86_64-unknown-linux-musl
- - name: Build
- run: cargo build --release --target ${{ matrix.target }}
- - name: Package (Windows)
- if: runner.os == 'Windows'
- run: |
- mkdir -p release
- cp target/${{ matrix.target }}/release/pong.exe release/
- cd release
- 7z a ../pong-${{ matrix.name }}.zip *
- - name: Package (Unix)
- if: runner.os != 'Windows'
- run: |
- mkdir -p release
- cp target/${{ matrix.target }}/release/pong release/
- cd release
- zip -r ../pong-${{ matrix.name }}.zip *
- - name: Upload artifacts
- uses: actions/upload-artifact@v3
- with:
- name: pong-${{ matrix.name }}
- path: pong-${{ matrix.name }}.zip
- create-release:
- name: Create GitHub Release
- needs: build
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v4
- - name: Download all artifacts
- uses: actions/download-artifact@v3
- with:
- path: artifacts
- - name: Create Release
- id: create_release
- uses: softprops/action-gh-release@v1
- with:
- files: |
- artifacts/pong-linux-x86_64/pong-linux-x86_64.zip
- artifacts/pong-linux-musl-x86_64/pong-linux-musl-x86_64.zip
- artifacts/pong-darwin-x86_64/pong-darwin-x86_64.zip
- artifacts/pong-darwin-aarch64/pong-darwin-aarch64.zip
- artifacts/pong-windows-x86_64/pong-windows-x86_64.zip
- draft: false
- prerelease: false
- token: ${{ secrets.GITHUB_TOKEN }}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement