From 28a5f72dfa80aecfedd7dbad99ea4bb43ac15453 Mon Sep 17 00:00:00 2001 From: Lucas Jansson Date: Mon, 13 Dec 2021 08:59:39 +0100 Subject: [PATCH] actions: Create release on push --- .github/workflows/CI.yml | 119 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 117 insertions(+), 2 deletions(-) diff --git a/.github/workflows/CI.yml b/.github/workflows/CI.yml index 91243c2..54ce97a 100644 --- a/.github/workflows/CI.yml +++ b/.github/workflows/CI.yml @@ -2,17 +2,32 @@ name: CI on: push: - paths-ignore: + paths-ignore: - '*.md' - '*.yml' pull_request: - paths-ignore: + paths-ignore: - '*.md' - '*.yml' jobs: + Init: + runs-on: ubuntu-latest + steps: + - name: Create build tag + run: | + export BUILD_TAG=build-$(date -u +'%Y%m%d%H%M') + echo "BUILD_TAG=$BUILD_TAG" >> $GITHUB_ENV + echo -n $BUILD_TAG > tag + - name: Upload artifacts + uses: actions/upload-artifact@v2 + with: + name: tag + path: tag + build-windows: runs-on: windows-latest + needs: Init env: POWERSHELL_TELEMETRY_OPTOUT: 1 strategy: @@ -47,6 +62,7 @@ jobs: build-linux: runs-on: ubuntu-latest + needs: Init steps: - uses: actions/checkout@v2 - name: CMake generate @@ -67,6 +83,7 @@ jobs: build-macos: runs-on: macos-latest + needs: Init steps: - uses: actions/checkout@v2 - name: CMake generate @@ -84,3 +101,101 @@ jobs: with: name: extract-xiso_${{ runner.os }} path: artifacts + + Release: + if: github.event_name == 'push' && github.ref == 'refs/heads/master' + runs-on: ubuntu-latest + needs: [build-windows, build-linux, build-macos] + env: + BUILD_TAG: + steps: + - name: Download artifacts + uses: actions/download-artifact@v2 + with: + path: dist + - name: Create archives + run: | + pushd dist/extract-xiso_Win32_Release + zip -r ../extract-xiso-win32-release.zip * + popd + pushd dist/extract-xiso_Win32_Debug + zip -r ../extract-xiso-win32-debug.zip * + popd + ### + # Comment out 64 bit builds as they are currently broken + ### + # pushd dist/extract-xiso_Win64_Release + # zip -r ../extract-xiso-win64-release.zip * + # popd + # pushd dist/extract-xiso_Win64_Debug + # zip -r ../extract-xiso-win64-debug.zip * + # popd + # pushd dist/extract-xiso_macOS + # zip -r ../extract-xiso-macos.zip * + # popd + - name: Get package info + run: | + echo "BUILD_TAG=$(cat dist/tag/tag)" >> $GITHUB_ENV + - name: Create release + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ env.BUILD_TAG }} + release_name: ${{ env.BUILD_TAG }} + draft: false + prerelease: false + - name: Upload release assets (Win32 build) + id: upload-release-assets-win32-release + uses: actions/upload-release-asset@v1.0.1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_name: extract-xiso-win32-release.zip + asset_path: dist/extract-xiso-win32-release.zip + asset_content_type: application/zip + - name: Upload release assets (Win32 debug build) + id: upload-release-assets-win32-debug + uses: actions/upload-release-asset@v1.0.1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_name: extract-xiso-win32-debug.zip + asset_path: dist/extract-xiso-win32-debug.zip + asset_content_type: application/zip + ### + # Comment out 64 bit builds as they are currently broken + ### + # - name: Upload release assets (Win64 build) + # id: upload-release-assets-win64-release + # uses: actions/upload-release-asset@v1.0.1 + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # with: + # upload_url: ${{ steps.create_release.outputs.upload_url }} + # asset_name: extract-xiso-win64-release.zip + # asset_path: dist/extract-xiso-win64-release.zip + # asset_content_type: application/zip + # - name: Upload release assets (Win64 debug build) + # id: upload-release-assets-win64-debug + # uses: actions/upload-release-asset@v1.0.1 + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # with: + # upload_url: ${{ steps.create_release.outputs.upload_url }} + # asset_name: extract-xiso-win64-debug.zip + # asset_path: dist/extract-xiso-win64-debug.zip + # asset_content_type: application/zip + # - name: Upload release assets (macOS build) + # id: upload-release-assets-macos-release + # uses: actions/upload-release-asset@v1.0.1 + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # with: + # upload_url: ${{ steps.create_release.outputs.upload_url }} + # asset_name: extract-xiso-macos.zip + # asset_path: dist/extract-xiso-macos.zip + # asset_content_type: application/zip