Release Desktop App #338
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| on: | |
| push: | |
| # Sequence of patterns matched against refs/tags | |
| tags: | |
| - "v*" # Push events to matching v*, i.e. v1.0, v20.15.10 | |
| jobs: | |
| build: | |
| runs-on: ${{ matrix.os }} | |
| # Platforms to build on/for | |
| strategy: | |
| matrix: | |
| os: [windows-latest, ubuntu-latest, macos-latest] | |
| node-version: [22.16.0] | |
| steps: | |
| - uses: pnpm/action-setup@v4 | |
| with: | |
| version: 10 | |
| - name: Check out Git repository | |
| uses: actions/checkout@v4 | |
| - name: Use Node.js ${{ matrix.node-version }} | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| cache: "pnpm" | |
| # install dbus-1 dep for xosms | |
| - if: matrix.os == 'ubuntu-latest' | |
| name: update apt and install utils | |
| run: | | |
| sudo apt update | |
| sudo apt install libdbus-1-dev elfutils | |
| - if: matrix.os == 'ubuntu-latest' | |
| name: install ubuntu snap | |
| continue-on-error: true | |
| run: | | |
| sudo apt install snapd | |
| sudo snap install snapcraft --classic | |
| - if: matrix.os == 'ubuntu-latest' | |
| name: install ubuntu flatpak | |
| continue-on-error: true | |
| run: | | |
| sudo apt install flatpak flatpak-builder | |
| sudo flatpak remote-add --if-not-exists flathub https://dl.flathub.org/repo/flathub.flatpakrepo | |
| - if: matrix.os == 'windows-latest' | |
| name: install windows deps | |
| uses: GuillaumeFalourd/setup-windows10-sdk-action@v2.4 | |
| with: | |
| sdk-version: 19041 | |
| - if: github.ref_type == 'tag' | |
| id: getVersion | |
| uses: actions/github-script@v7.0.1 | |
| env: | |
| REF_NAME: ${{ github.ref_name }} | |
| with: | |
| script: | | |
| const isVersion = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/ | |
| const id = process.env.REF_NAME && process.env.REF_NAME.split('v')[1] || process.env.REF_NAME | |
| const isRC = id.includes('-rc.') | |
| core.setOutput("value", id); | |
| core.setOutput("ok", isVersion.test(id)) | |
| core.setOutput("releaseType", isRC ? 'rc' : 'stable') | |
| - if: github.ref_type == 'tag' && steps.getVersion.outputs.ok | |
| name: set app version | |
| uses: jossef/action-set-json-field@v2.2 | |
| with: | |
| file: package.json | |
| field: version | |
| value: ${{ steps.getVersion.outputs.value }} | |
| - name: Install dependencies | |
| run: | | |
| pnpm install --frozen-lockfile | |
| - if: matrix.os == 'macos-latest' | |
| name: Write APPLE_API_KEY to AuthKey.p8 | |
| run: | | |
| mkdir -p .secrets | |
| echo "${{ secrets.APPLE_API_KEY }}" > .secrets/AuthKey.p8 | |
| chmod 600 .secrets/AuthKey.p8 | |
| export APPLE_API_KEY="${{ github.workspace }}/.secrets/AuthKey.p8" | |
| export APPLE_API_KEY_ID=${{ secrets.APPLE_API_KEY_ID }} | |
| export APPLE_API_ISSUER=${{ secrets.APPLE_API_ISSUER }} | |
| - name: Build Electron release | |
| run: pnpm release | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| VITE_SENTRY_DSN: ${{ secrets.SENTRY_DSN }} | |
| VITE_DISCORD_CLIENT_ID: ${{ secrets.DISCORD_CLIENT_ID }} | |
| VITE_LASTFM_API: ${{ secrets.LASTFM_API }} | |
| VITE_LASTFM_SECRET: ${{ secrets.LASTFM_SECRET }} | |
| VITE_GITHUB_REPOSITORY: ${{ github.repository }} | |
| APPLE_API_KEY: ${{ env.APPLE_API_KEY }} | |
| APPLE_API_KEY_ID: ${{ env.APPLE_API_KEY_ID }} | |
| APPLE_API_ISSUER: ${{ env.APPLE_API_ISSUER }} | |
| - if: matrix.os == 'macos-latest' | |
| name: Cleanup certificates and keys | |
| run: | | |
| rm -rf .secrets | |
| - if: matrix.os == 'ubuntu-latest' | |
| name: Upload release source maps to sentry | |
| continue-on-error: true | |
| env: | |
| SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} | |
| SENTRY_PROJECT: ytmdesktop | |
| SENTRY_ORG: venipa.net | |
| SENTRY_DEPLOY_ENVIRONMENT: production | |
| SENTRY_DSN: ${{ secrets.SENTRY_DSN }} | |
| SENTRY_URL: ${{ secrets.SENTRY_URL }} | |
| run: | | |
| # Install Sentry CLI | |
| curl -sL https://sentry.io/get-cli/ | bash | |
| # Create new Sentry release | |
| export SENTRY_RELEASE=$(sentry-cli releases propose-version) | |
| sentry-cli releases new --project $SENTRY_PROJECT $SENTRY_RELEASE | |
| sentry-cli releases set-commits --auto $SENTRY_RELEASE | |
| sentry-cli releases finalize $SENTRY_RELEASE | |
| # Create new deploy for this Sentry release | |
| sentry-cli releases deploys $SENTRY_RELEASE new -e $SENTRY_DEPLOY_ENVIRONMENT | |
| # - if: matrix.os == 'windows-latest' && steps.getVersion.outputs.releaseType == 'stable' | |
| # name: Upload new winget release | |
| # uses: vedantmgoyal9/winget-releaser@v2 | |
| # with: | |
| # # The PackageIdentifier of the package (case-sensitive). | |
| # identifier: venipa.ytmdesktop | |
| # # The PackageVersion of the package you want to release. | |
| # version: ${{steps.getVersion.outputs.value}} | |
| # # The regex to match the installers. | |
| # installers-regex: dist\\.*-setup.(exe|msi|msix|appx)(bundle){0,1}$ | |
| # # The maximum number of versions to keep in WinGet Community Repository (Default: 0 - no limit) | |
| # max-versions-to-keep: 10 | |
| # # The repository where the release is present (should be present under same user/organization). | |
| # release-repository: ${{ github.event.repository.name }} | |
| # # The release tag to be used for creating manifests. | |
| # release-tag: v${{steps.getVersion.outputs.value}} | |
| # # GitHub token to create pull request on Windows Package Manager Community Repository. | |
| # token: ${{ secrets.GITHUB_TOKEN }} | |
| # # GitHub username where the fork of winget-pkgs is present. | |
| # fork-user: ${{ github.repository_owner }} |