From 6d19d21b98a646b79f71ac681dffbedf4d9ea6c4 Mon Sep 17 00:00:00 2001 From: Riprod <131838720+ItsRiprod@users.noreply.github.com> Date: Sun, 14 Jul 2024 18:18:15 -0400 Subject: [PATCH] Update build.yml --- .github/workflows/build.yml | 56 +++++++++++++++++++++---------------- 1 file changed, 32 insertions(+), 24 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 730eb2c..c0b7272 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -33,16 +33,6 @@ jobs: cd ./DeskThingServer npm run typecheck - - name: Install snapcraft on Linux - if: runner.os == 'Linux' - run: | - sudo snap install snapcraft --classic - - - name: Build the project - run: | - cd ./DeskThingServer - npm run build - - name: Build application for Windows if: runner.os == 'Windows' run: | @@ -61,32 +51,30 @@ jobs: cd ./DeskThingServer npm run build:linux + - name: Extract version from tag + id: get_version + run: echo "::set-output name=VERSION::${GITHUB_REF/refs\/tags\/v/}" + - name: Upload artifact for Windows if: runner.os == 'Windows' uses: actions/upload-artifact@v3 with: - name: DeskThing-windows-latest # Artifact name for Windows - path: | - ./DeskThingServer/dist/* - !./DeskThingServer/dist/**/*.map + name: DeskThing-${{ steps.get_version.outputs.VERSION }}-windows-setup.exe + path: ./DeskThingServer/dist/*.exe - name: Upload artifact for macOS if: runner.os == 'macOS' uses: actions/upload-artifact@v3 with: - name: DeskThing-macos-latest # Artifact name for macOS - path: | - ./DeskThingServer/dist/* - !./DeskThingServer/dist/**/*.map + name: DeskThing-${{ steps.get_version.outputs.VERSION }}-mac-setup.dmg + path: ./DeskThingServer/dist/*.dmg - name: Upload artifact for Linux if: runner.os == 'Linux' uses: actions/upload-artifact@v3 with: - name: DeskThing-ubuntu-latest # Artifact name for Linux - path: | - ./DeskThingServer/dist/* - !./DeskThingServer/dist/**/*.map + name: DeskThing-${{ steps.get_version.outputs.VERSION }}-linux.AppImage + path: ./DeskThingServer/dist/*.AppImage release: needs: build # Runs after build job @@ -109,7 +97,27 @@ jobs: name: DeskThing-windows-latest path: ./dist/windows - - name: Create Release + - name: Check for existing release + id: release_check + run: | + TAG_NAME=$(git describe --tags --exact-match ${{ github.sha }}) + echo "::set-output name=tag_name::${TAG_NAME}" + + - name: Create or update release + if: steps.release_check.outputs.tag_name != '' + id: create_release + uses: softprops/action-gh-release@v1 + with: + tag_name: ${{ steps.release_check.outputs.tag_name }} + files: | + ./dist/ubuntu/* + ./dist/macos/* + ./dist/windows/* + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Create new release if no existing release found + if: steps.release_check.outputs.tag_name == '' uses: softprops/action-gh-release@v1 with: files: | @@ -117,4 +125,4 @@ jobs: ./dist/macos/* ./dist/windows/* env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}