diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..a09ad58 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,88 @@ +name: Release + +on: + workflow_dispatch + +env: + CARGO_TERM_COLOR: always + +jobs: + linux: + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v3 + - uses: Swatinem/rust-cache@v2 + - name: Build csdemoparser + run: cargo build -p csdemoparser --release + - name: Test csdemoparser + run: cargo test -p csdemoparser --release + - uses: actions/upload-artifact@v4 + with: + name: rust-linux + path: target/release/csdemoparser + + windows: + runs-on: windows-latest + steps: + - uses: actions/checkout@v3 + - uses: Swatinem/rust-cache@v2 + - name: Build csdemoparser + run: cargo build -p csdemoparser --release + - name: Test csdemoparser + run: cargo test -p csdemoparser --release + - uses: actions/upload-artifact@v4 + with: + name: rust-windows + path: target/release/csdemoparser.exe + + package: + runs-on: ubuntu-latest + needs: [linux, windows] + steps: + - uses: actions/checkout@v3 + # oldui + - uses: actions/setup-node@v3 + with: + node-version: '18' + cache: 'npm' + - run: npm install -g bower + - run: bower install + # Clojure + - uses: actions/setup-java@v3 + with: + distribution: 'zulu' + java-version: '17' + - name: Install Leiningen + uses: DeLaGuardo/setup-clojure@11.0 + with: + lein: '2.10.0' + - name: Cache Clojure dependencies + uses: actions/cache@v3 + with: + path: ~/.m2/repository + key: cljdeps-${{ hashFiles('project.clj') }} + restore-keys: cljdeps- + - name: Build jar + run: LEIN_SNAPSHOTS_IN_RELEASE=1 lein uberjar + - run: | + mv target-lein/hsbox-*-standalone.jar target-lein/hsbox-standalone.jar + echo 'java -jar hsbox-standalone.jar --port 4000' > target-lein/headshotbox.sh + echo 'start javaw -jar hsbox-standalone.jar --port 4000 --systray' > target-lein/headshotbox.bat + echo 'java -jar hsbox-standalone.jar --port 4000' > target-lein/headshotbox_console.bat' + chmod a+x target-lein/headshotbox.sh + # Package + - uses: actions/download-artifact@v4 + with: + path: release + merge-multiple: true + - name: Zip + run: | + zip -j headshotbox-linux.zip target-lein/hsbox-standalone.jar target-lein/headshotbox.sh release/csdemoparser + zip -j headshotbox-win.zip target-lein/hsbox-standalone.jar target-lein/headshotbox.bat target-lein/headshotbox_console.bat release/csdemoparser.exe + - name: Release + uses: softprops/action-gh-release@v1 + with: + draft: true + files: | + headshotbox-linux.zip + headshotbox-win.zip