From dc64482575ee0e6f1efec0ff6fded23be82fe1a3 Mon Sep 17 00:00:00 2001 From: Matthew To Date: Thu, 18 Jan 2024 16:37:40 +0900 Subject: [PATCH 1/2] fix: test upgraded snapcraft action --- .github/workflows/release-test.yml | 138 +++++++++++++++++++++++++++++ 1 file changed, 138 insertions(+) create mode 100644 .github/workflows/release-test.yml diff --git a/.github/workflows/release-test.yml b/.github/workflows/release-test.yml new file mode 100644 index 000000000..05b43d600 --- /dev/null +++ b/.github/workflows/release-test.yml @@ -0,0 +1,138 @@ +# Only run on master push +name: Release Executables Binaries + +on: + push: + branches: + - fix/snapcraft-auth +jobs: + release: + runs-on: ${{ matrix.os }} + permissions: + contents: write + environment: deployment + + strategy: + matrix: + os: [ubuntu-latest] + + steps: + - name: setup dependencies + if: startsWith(matrix.os, 'ubuntu') + run: sudo apt-get update && sudo apt-get install -y libusb-1.0-0-dev libudev-dev libarchive-tools + + - name: Check out Git repository + uses: actions/checkout@v1 + + - name: Install Node.js, NPM and Yarn + uses: actions/setup-node@v1 + with: + node-version: 16 + + - name: Install deps with big timeout + run: | + yarn install --network-timeout 600000 + + - name: Install Snapcraft + uses: samuelmeuli/action-snapcraft@v2 + # Only install Snapcraft on Ubuntu + if: startsWith(matrix.os, 'ubuntu') + with: + # Log in to Snap Store + SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_TOKEN }} + + # - name: Install AzureSignTool + # # Only install Azure Sign Tool on Windows + # if: startsWith(matrix.os, 'windows') + # run: dotnet tool install --global AzureSignTool + + - name: Extract current branch name + shell: bash + run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" + id: extract_branch + + - name: Get name & version from package.json + shell: bash + run: | + echo "##[set-output name=name;]$(node -p -e '`${require("./package.json").name}`')" + echo "##[set-output name=version;]$(node -p -e '`${require("./package.json").version}`')" + id: package_json + + - name: Log release reference + run: | + echo "********* START RELEASE REF **********" + echo ${{ github.ref }} + echo branch: ${{ steps.extract_branch.outputs.branch }} + echo name: ${{ steps.package_json.outputs.name }} + echo version: ${{ steps.package_json.outputs.version }} + echo "********* END RELEASE REF ************" + + - name: Prepare for app notarization (MacOS) + if: startsWith(matrix.os, 'macos') + # Import Apple API key for app notarization on macOS + run: | + mkdir -p ~/private_keys/ + echo '${{ secrets.mac_api_key }}' > ~/private_keys/AuthKey_${{ secrets.mac_api_key_id }}.p8 + + - name: Build/release Electron app (MacOS, Ubuntu, Windows) + uses: samuelmeuli/action-electron-builder@v1 + # if: startsWith(matrix.os, 'macos') || startsWith(matrix.os, 'ubuntu') + with: + + build_script_name: electron:pre-build + + # GitHub token, automatically provided to the action + # (No need to define this secret in the repo settings) + github_token: ${{ secrets.github_token }} + + # When a push is done to master, the action builds binaries for all OS and they are then released directly + release: ${{ steps.extract_branch.outputs.branch == 'master' }} + + mac_certs: ${{ secrets.mac_certs }} + mac_certs_password: ${{ secrets.mac_certs_password }} + + env: + # macOS notarization API key + API_KEY_ID: ${{ secrets.mac_api_key_id }} + API_KEY_ISSUER_ID: ${{ secrets.mac_api_key_issuer_id }} + + # - name: Build Electron app (Windows) + # if: startsWith(matrix.os, 'windows') + # run: | + # yarn run electron:build + + # - name: Sign built binary (Windows) + # if: startsWith(matrix.os, 'windows') + # # Instead of pointing to a specific .exe, uses a PowerShell script which iterates through all the files stored in dist folder. + # # If the file has the .exe extension, then it will use the AzureSignTool command to sign it. + # run: | + # cd dist; Get-ChildItem -recurse -Include **.exe | ForEach-Object { + # $exePath = $_.FullName + # & AzureSignTool sign -kvu "${{ secrets.azure_key_vault_url }}" -kvi "${{ secrets.azure_key_vault_client_id }}" -kvt "${{ secrets.azure_key_vault_tenant_id }}" -kvs "${{ secrets.azure_key_vault_client_secret }}" -kvc "${{ secrets.azure_key_vault_name }}" -tr http://timestamp.digicert.com -v $exePath + # }; cd .. + + # - name: Cleanup artifacts (Windows) + # if: startsWith(matrix.os, 'windows') + # run: | + # mkdir dist/temp; Move-Item -Path dist/*.exe, dist/*.blockmap, dist/latest.yml -Destination dist/temp + # npx rimraf "dist/!(temp)" + # npx rimraf "dist/.icon-ico" + # mv dist/temp/* dist + # npx rimraf "dist/temp" + + # - name: Upload artifacts (Windows) + # uses: actions/upload-artifact@v2 + # if: startsWith(matrix.os, 'windows') + # with: + # name: ${{ matrix.os }} + # path: dist + + # - name: Release Electron app (Windows) + # uses: softprops/action-gh-release@v1 + # if: startsWith(matrix.os, 'windows') + # with: + # draft: true + # tag_name: v${{ steps.package_json.outputs.version }} + # files: "dist/**" + # env: + # GITHUB_TOKEN: ${{ secrets.github_token }} From d3df33c654e9ea3524a01fbca5882674d2233dc0 Mon Sep 17 00:00:00 2001 From: Matthew To Date: Thu, 18 Jan 2024 17:01:56 +0900 Subject: [PATCH 2/2] fix: upgrade snapcraft action --- .github/workflows/release-test.yml | 138 ----------------------------- .github/workflows/release.yml | 4 +- 2 files changed, 2 insertions(+), 140 deletions(-) delete mode 100644 .github/workflows/release-test.yml diff --git a/.github/workflows/release-test.yml b/.github/workflows/release-test.yml deleted file mode 100644 index 05b43d600..000000000 --- a/.github/workflows/release-test.yml +++ /dev/null @@ -1,138 +0,0 @@ -# Only run on master push -name: Release Executables Binaries - -on: - push: - branches: - - fix/snapcraft-auth -jobs: - release: - runs-on: ${{ matrix.os }} - permissions: - contents: write - environment: deployment - - strategy: - matrix: - os: [ubuntu-latest] - - steps: - - name: setup dependencies - if: startsWith(matrix.os, 'ubuntu') - run: sudo apt-get update && sudo apt-get install -y libusb-1.0-0-dev libudev-dev libarchive-tools - - - name: Check out Git repository - uses: actions/checkout@v1 - - - name: Install Node.js, NPM and Yarn - uses: actions/setup-node@v1 - with: - node-version: 16 - - - name: Install deps with big timeout - run: | - yarn install --network-timeout 600000 - - - name: Install Snapcraft - uses: samuelmeuli/action-snapcraft@v2 - # Only install Snapcraft on Ubuntu - if: startsWith(matrix.os, 'ubuntu') - with: - # Log in to Snap Store - SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_TOKEN }} - - # - name: Install AzureSignTool - # # Only install Azure Sign Tool on Windows - # if: startsWith(matrix.os, 'windows') - # run: dotnet tool install --global AzureSignTool - - - name: Extract current branch name - shell: bash - run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" - id: extract_branch - - - name: Get name & version from package.json - shell: bash - run: | - echo "##[set-output name=name;]$(node -p -e '`${require("./package.json").name}`')" - echo "##[set-output name=version;]$(node -p -e '`${require("./package.json").version}`')" - id: package_json - - - name: Log release reference - run: | - echo "********* START RELEASE REF **********" - echo ${{ github.ref }} - echo branch: ${{ steps.extract_branch.outputs.branch }} - echo name: ${{ steps.package_json.outputs.name }} - echo version: ${{ steps.package_json.outputs.version }} - echo "********* END RELEASE REF ************" - - - name: Prepare for app notarization (MacOS) - if: startsWith(matrix.os, 'macos') - # Import Apple API key for app notarization on macOS - run: | - mkdir -p ~/private_keys/ - echo '${{ secrets.mac_api_key }}' > ~/private_keys/AuthKey_${{ secrets.mac_api_key_id }}.p8 - - - name: Build/release Electron app (MacOS, Ubuntu, Windows) - uses: samuelmeuli/action-electron-builder@v1 - # if: startsWith(matrix.os, 'macos') || startsWith(matrix.os, 'ubuntu') - with: - - build_script_name: electron:pre-build - - # GitHub token, automatically provided to the action - # (No need to define this secret in the repo settings) - github_token: ${{ secrets.github_token }} - - # When a push is done to master, the action builds binaries for all OS and they are then released directly - release: ${{ steps.extract_branch.outputs.branch == 'master' }} - - mac_certs: ${{ secrets.mac_certs }} - mac_certs_password: ${{ secrets.mac_certs_password }} - - env: - # macOS notarization API key - API_KEY_ID: ${{ secrets.mac_api_key_id }} - API_KEY_ISSUER_ID: ${{ secrets.mac_api_key_issuer_id }} - - # - name: Build Electron app (Windows) - # if: startsWith(matrix.os, 'windows') - # run: | - # yarn run electron:build - - # - name: Sign built binary (Windows) - # if: startsWith(matrix.os, 'windows') - # # Instead of pointing to a specific .exe, uses a PowerShell script which iterates through all the files stored in dist folder. - # # If the file has the .exe extension, then it will use the AzureSignTool command to sign it. - # run: | - # cd dist; Get-ChildItem -recurse -Include **.exe | ForEach-Object { - # $exePath = $_.FullName - # & AzureSignTool sign -kvu "${{ secrets.azure_key_vault_url }}" -kvi "${{ secrets.azure_key_vault_client_id }}" -kvt "${{ secrets.azure_key_vault_tenant_id }}" -kvs "${{ secrets.azure_key_vault_client_secret }}" -kvc "${{ secrets.azure_key_vault_name }}" -tr http://timestamp.digicert.com -v $exePath - # }; cd .. - - # - name: Cleanup artifacts (Windows) - # if: startsWith(matrix.os, 'windows') - # run: | - # mkdir dist/temp; Move-Item -Path dist/*.exe, dist/*.blockmap, dist/latest.yml -Destination dist/temp - # npx rimraf "dist/!(temp)" - # npx rimraf "dist/.icon-ico" - # mv dist/temp/* dist - # npx rimraf "dist/temp" - - # - name: Upload artifacts (Windows) - # uses: actions/upload-artifact@v2 - # if: startsWith(matrix.os, 'windows') - # with: - # name: ${{ matrix.os }} - # path: dist - - # - name: Release Electron app (Windows) - # uses: softprops/action-gh-release@v1 - # if: startsWith(matrix.os, 'windows') - # with: - # draft: true - # tag_name: v${{ steps.package_json.outputs.version }} - # files: "dist/**" - # env: - # GITHUB_TOKEN: ${{ secrets.github_token }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3ab30d19e..899db9f16 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -34,12 +34,12 @@ jobs: yarn install --network-timeout 600000 - name: Install Snapcraft - uses: samuelmeuli/action-snapcraft@v1 + uses: samuelmeuli/action-snapcraft@v2 # Only install Snapcraft on Ubuntu if: startsWith(matrix.os, 'ubuntu') with: # Log in to Snap Store - snapcraft_token: ${{ secrets.snapcraft_token }} + SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_TOKEN }} # - name: Install AzureSignTool # # Only install Azure Sign Tool on Windows