From 5f99f2aecdfa9a91d29ded5abd3ca7f20d6aaacd Mon Sep 17 00:00:00 2001 From: Andrei Benea Date: Fri, 9 Feb 2024 07:44:39 +0100 Subject: [PATCH] Release workflow. --- .github/workflows/build.yml | 20 ++++----- .github/workflows/release.yml | 81 +++++++++++++++++++++++++++++++++++ 2 files changed, 89 insertions(+), 12 deletions(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c41eb41..771435a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -11,15 +11,13 @@ jobs: linux: runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v3 - with: - submodules: true + - uses: actions/checkout@v4 - uses: Swatinem/rust-cache@v2 + - name: Test csdemoparser + run: cargo test --release - name: Build csdemoparser run: cargo build -p csdemoparser --release - - name: Test csdemoparser - run: cargo test -p csdemoparser --release - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: rust-linux path: target/release/csdemoparser @@ -27,15 +25,13 @@ jobs: windows: runs-on: windows-latest steps: - - uses: actions/checkout@v3 - with: - submodules: true + - uses: actions/checkout@v4 - uses: Swatinem/rust-cache@v2 + - name: Test csdemoparser + run: cargo test --release - name: Build csdemoparser run: cargo build -p csdemoparser --release - - name: Test csdemoparser - run: cargo test -p csdemoparser --release - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: rust-windows path: target/release/csdemoparser.exe diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..ae7bb80 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,81 @@ +name: Release + +on: + workflow_dispatch + +env: + CARGO_TERM_COLOR: always + +jobs: + build: + strategy: + matrix: + os: [ubuntu-20.04, windows-latest] + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v4 + - uses: Swatinem/rust-cache@v2 + - name: Test + run: cargo test --release + - name: Build csdemoparser + run: cargo build -p csdemoparser --release + - uses: actions/upload-artifact@v4 + with: + name: ${{ matrix.os }} + path: | + target/release/csdemoparser + target/release/csdemoparser.exe + + package: + runs-on: ubuntu-latest + needs: build + steps: + - uses: actions/checkout@v4 + # oldui + - uses: actions/setup-node@v4 + with: + node-version: '18' + - run: npm install -g bower + - run: bower install + # Clojure + - uses: actions/setup-java@v4 + with: + distribution: 'zulu' + java-version: '17' + - name: Install Leiningen + uses: DeLaGuardo/setup-clojure@12.3 + with: + lein: '2.10.0' + - name: Cache Clojure dependencies + uses: actions/cache@v4 + with: + path: ~/.m2/repository + key: cljdeps-${{ hashFiles('project.clj') }} + restore-keys: cljdeps- + - name: Build jar + run: LEIN_SNAPSHOTS_IN_RELEASE=1 lein uberjar + # Package + - uses: actions/download-artifact@v4 + - name: Package Windows + run: | + mkdir windows/headshotbox + cp windows-latest/csdemoparser.exe windows/headshotbox/ + cp target-lein/hsbox-*-standalone.jar windows/headshotbox/hsbox-standalone.jar + echo 'start javaw -jar hsbox-standalone.jar --port 4000 --systray' > windows/headshotbox/headshotbox.bat + echo 'java -jar hsbox-standalone.jar --port 4000' > windows/headshotbox/headshotbox_console.bat + cd windows && zip ../headshotbox-win.zip headshotbox/* + - name: Package Linux + run: | + mkdir linux/headshotbox + cp ubuntu-20.04/csdemoparser linux/headshotbox/ + cp target-lein/hsbox-*-standalone.jar linux/headshotbox/hsbox-standalone.jar + echo 'java -jar hsbox-standalone.jar --port 4000' > linux/headshotbox/headshotbox.sh + chmod a+x linux/headshotbox/headshotbox.sh + cd linux && zip ../headshotbox-linux.zip headshotbox/* + - name: Release + uses: softprops/action-gh-release@v1 + with: + draft: true + files: | + headshotbox-linux.zip + headshotbox-win.zip