From c3ea50048792f3f78dd8d1d6214c2af36fd3412e Mon Sep 17 00:00:00 2001 From: Allen Joe Date: Mon, 18 Nov 2024 02:28:41 +0800 Subject: [PATCH] ci: release --- .github/workflows/release.yml | 69 +++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..75b96d4 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,69 @@ +name: Release + +on: + workflow_dispatch: + inputs: + version: + description: "Tag version to release" + required: true + +jobs: + build: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + include: + - os: ubuntu-latest + extension: ".tar.gz" + system_name: "linux" + - os: macos-latest + extension: ".tar.gz" + system_name: "macos" + - os: windows-latest + extension: ".zip" + system_name: "windows" + + steps: + # Checkout the repository + - uses: actions/checkout@v4 + + # Set up Rust environment + - uses: actions-rs/toolchain@v1 + with: + toolchain: stable + - uses: Swatinem/rust-cache@v2 + with: + key: ${{ matrix.os }} + # Build Rust backend + - name: Build + run: cargo build --release + - name: Archive atrifacts + if: ${{matrix.os != 'windows-latest' }} + uses: actions/upload-artifact@v4 + with: + name: ping-server-rs-${{ matrix.os }} + path: | + ./target/release/ping-server-rs + - name: Archive atrifacts + if: ${{matrix.os == 'windows-latest' }} + uses: actions/upload-artifact@v4 + with: + name: ping-server-rs-${{ matrix.os }} + path: | + ./target/release/ping-server-rs.exe + Upload-Release: + permissions: write-all + needs: [build] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/download-artifact@v4 + with: + path: output/ + merge-multiple: true + - name: Upload Release + uses: softprops/action-gh-release@v2 + with: + files: output/* + tag_name: ${{ github.event.inputs.version }}