From acac6879463ed331534873fec08433f63d09a313 Mon Sep 17 00:00:00 2001 From: Quentin Gliech Date: Sat, 26 Sep 2020 15:14:57 +0200 Subject: [PATCH] CI: publish executables in releases Squashed commit of the following: commit 50f8edc92fbf82e03e792f74632684adbe59cff6 Author: Quentin Gliech Date: Sat Sep 26 15:03:26 2020 +0200 CI: fix syntax commit 0e07fc61cbf1ce2815b8316ef09d8fe747513e11 Author: Quentin Gliech Date: Sat Sep 26 15:00:08 2020 +0200 CI: upload artifacts on new releases commit a6959dfe8415e65f99e8e8e21866a4c5bd3b270a Author: Quentin Gliech Date: Sat Sep 26 14:43:46 2020 +0200 CI: fix archive path commit 61bda249d4caf0d4d3e578fe04ffbc827b1e226a Author: Quentin Gliech Date: Sat Sep 26 14:38:22 2020 +0200 fix step IDs commit 206f643a803ff28c4563f1ca6068417937a026dc Author: Quentin Gliech Date: Sat Sep 26 14:36:30 2020 +0200 WIP: publish executables in releases --- .github/workflows/compile.yaml | 63 +++++++++++++++++++++++++++++++++- 1 file changed, 62 insertions(+), 1 deletion(-) diff --git a/.github/workflows/compile.yaml b/.github/workflows/compile.yaml index d0ab20d8..a1712987 100644 --- a/.github/workflows/compile.yaml +++ b/.github/workflows/compile.yaml @@ -1,4 +1,9 @@ -on: [push, pull_request] +on: + push: + pull_request: + release: + types: + - created name: Compile @@ -44,3 +49,59 @@ jobs: with: name: z33-emulator-${{ matrix.target }} path: target/${{ matrix.target }}/release/${{ matrix.exe }} + + publish: + name: Publish draft release + needs: [build] + runs-on: ubuntu-20.04 + if: github.event_name == 'release' + + steps: + - uses: actions/download-artifact@v2 + with: + path: artifacts + + - name: Fix permissions (x86_64-apple-darwin) + run: chmod +x artifacts/z33-emulator-x86_64-apple-darwin/z33-emulator + + - name: Fix permissions (x86_64-unknown-linux-musl) + run: chmod +x artifacts/z33-emulator-x86_64-unknown-linux-musl/z33-emulator + + - name: Create darwin archive + run: tar -czvf z33-emulator-x86_64-apple-darwin.tar.gz --owner=0 --group=0 -C artifacts/z33-emulator-x86_64-apple-darwin/ z33-emulator + + - name: Create linux archive + run: tar -czvf z33-emulator-x86_64-unknown-linux-musl.tar.gz --owner=0 --group=0 -C artifacts/z33-emulator-x86_64-unknown-linux-musl/ z33-emulator + + - name: Upload darwin archive + id: upload-darwin-asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: ./z33-emulator-x86_64-apple-darwin.tar.gz + asset_name: z33-emulator-x86_64-apple-darwin.tar.gz + asset_content_type: application/tar+gzip + + - name: Upload linux archive + id: upload-linux-asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: ./z33-emulator-x86_64-unknown-linux-musl.tar.gz + asset_name: z33-emulator-x86_64-unknown-linux-musl.tar.gz + asset_content_type: application/tar+gzip + + - name: Upload windows executable + id: upload-windows-asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: ./artifacts/z33-emulator-x86_64-pc-windows-msvc/z33-emulator.exe + asset_name: z33-emulator-x86_64-pc-windows-msvc.exe + asset_content_type: application/vnd.microsoft.portable-executable