From bd1a745658b8d26c4dc169eaaa48ea5a2bd4e7a5 Mon Sep 17 00:00:00 2001 From: chen fan <1490040662@qq.com> Date: Wed, 3 Jul 2024 09:57:24 +0800 Subject: [PATCH] chore: update workflows --- .github/workflows/release.yml | 129 +++++++++++++++++++++++++++++++--- package-lock.json | 4 +- 2 files changed, 123 insertions(+), 10 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 42e1ac3..3d6b980 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,10 +11,10 @@ jobs: matrix: os: [macos-latest, windows-latest] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Setup Node.js - uses: actions/setup-node@v2 + uses: actions/setup-node@v4 with: node-version: '20' @@ -24,6 +24,10 @@ jobs: - name: Install dependencies run: pnpm install + - name: Get version from package.json + id: get_version + run: echo "VERSION=$(node -p -e "require('./package.json').version")" >> $GITHUB_ENV + - name: Build Electron App run: | if [ "${{ runner.os }}" == "Windows" ]; then @@ -33,10 +37,119 @@ jobs: fi shell: bash - - name: Upload Artifact - uses: actions/upload-artifact@v2 + # - name: Upload Artifact + # uses: actions/upload-artifact@v4 + # with: + # name: fideo-${{ runner.os }} + # path: | + # dist/*.exe + # dist/*.dmg + + # - name: Archive Windows build artifacts + # if: ${{ runner.os == 'Windows' }} + # run: | + # # echo "VERSION=$(node -p -e "require('./package.json').version")" >> $env:GITHUB_ENV + # tar -czf fideo-win-${{ env.VERSION }}.tar.gz dist/fideo-${{ env.VERSION }}.exe + # shell: bash + + # - name: Archive macOS build artifacts (x64) + # if: ${{ runner.os == 'macOS' }} + # run: tar -czf fideo-mac-x64-${{ env.VERSION }}.tar.gz dist/fideo-${{ env.VERSION }}-x64.dmg + + # - name: Archive macOS build artifacts (arm) + # if: ${{ runner.os == 'macOS' }} + # run: tar -czf fideo-mac-arm-${{ env.VERSION }}.tar.gz dist/fideo-${{ env.VERSION }}-arm64.dmg + + - name: Upload Windows build artifact + if: ${{ runner.os == 'Windows' }} + uses: actions/upload-artifact@v4 + with: + name: build-win-${{ env.VERSION }} + path: dist/fideo-${{ env.VERSION }}.exe + shell: bash + + - name: Upload macOS build artifacts (x64) + if: ${{ runner.os == 'macOS' }} + uses: actions/upload-artifact@v4 + with: + name: build-mac-x64-${{ env.VERSION }} + path: dist/fideo-${{ env.VERSION }}-x64.dmg + + - name: Upload macOS build artifacts (arm) + if: ${{ runner.os == 'macOS' }} + uses: actions/upload-artifact@v4 with: - name: electron-app-${{ runner.os }} - path: | - dist/*.exe - dist/*.dmg + name: build-mac-arm-${{ env.VERSION }} + path: dist/fideo-${{ env.VERSION }}-arm64.dmg + + release: + needs: build + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Get version from package.json + id: get_version + run: echo "VERSION=$(node -p -e "require('./package.json').version")" >> $GITHUB_ENV + + - name: Download Windows build artifact + uses: actions/download-artifact@v2 + with: + name: build-win-${{ env.VERSION }} + path: . + + - name: Download macOS build artifacts (x64) + uses: actions/download-artifact@v4 + with: + name: build-mac-x64-${{ env.VERSION }} + path: . + + - name: Download macOS build artifacts (arm) + uses: actions/download-artifact@v4 + with: + name: build-mac-arm-${{ env.VERSION }} + path: . + + # - name: Create Release + # id: create_release + # uses: elgohr/Github-Release-Action@v5 + # env: + # GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} + # with: + # tag_name: v${{ env.VERSION }} + # release_name: Release v${{ env.VERSION }} + # draft: false + # prerelease: false + + # - name: Upload Windows Release Asset + # uses: actions/upload-release-asset@v1 + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # with: + # upload_url: ${{ steps.create_release.outputs.upload_url }} + # asset_path: fideo-${{ env.VERSION }}.exe + # asset_name: fideo-${{ env.VERSION }}.exe + + - name: Upload macOS Release Asset (x64) + uses: softprops/action-gh-release@v2 + env: + GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} + with: + files: | + fideo-${{ env.VERSION }}-x64-.dmg + fideo-${{ env.VERSION }}-arm64.dmg + # fideo-${{ env.VERSION }}.exe + tag_name: v${{ env.VERSION }} + # upload_url: ${{ steps.create_release.outputs.upload_url }} + # asset_path: dist/fideo-${{ env.VERSION }}-x64.dmg + # asset_name: fideo-${{ env.VERSION }}-x64.dmg + + # - name: Upload macOS Release Asset (arm) + # uses: actions/upload-release-asset@v1 + # env: + # GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # with: + # upload_url: ${{ steps.create_release.outputs.upload_url }} + # asset_path: dist/fideo-${{ env.VERSION }}-arm64.dmg + # asset_name: dist/fideo-${{ env.VERSION }}-arm64.dmg diff --git a/package-lock.json b/package-lock.json index 5a5a26b..bba5b51 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "live-record", - "version": "1.0.0", + "version": "0.1.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "live-record", - "version": "1.0.0", + "version": "0.1.0", "hasInstallScript": true, "dependencies": { "@electron-toolkit/preload": "^3.0.0",