fix(pnpm): only install if not already installed #2560
This file contains 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
name: Publish | |
on: | |
push: | |
branches: | |
- main | |
- next | |
workflow_dispatch: | |
# Remove the branches section as it's not valid for workflow_dispatch | |
# workflow_dispatch allows manual triggering without branch restrictions | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
permissions: | |
contents: write | |
packages: write | |
actions: write | |
issues: write | |
pull-requests: write | |
jobs: | |
tag: | |
outputs: | |
kit_tag: ${{ steps.set_kit_tag.outputs.result }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Echo all available variables | |
run: | | |
echo "All available variables:" | |
echo "-------------------------" | |
echo "GITHUB_SHA: ${{ github.sha }}" | |
echo "GITHUB_REF: ${{ github.ref }}" | |
echo "GITHUB_WORKFLOW: ${{ github.workflow }}" | |
echo "GITHUB_ACTION: ${{ github.action }}" | |
echo "GITHUB_ACTOR: ${{ github.actor }}" | |
echo "GITHUB_REPOSITORY: ${{ github.repository }}" | |
echo "GITHUB_EVENT_NAME: ${{ github.event_name }}" | |
echo "GITHUB_WORKSPACE: ${{ github.workspace }}" | |
echo "GITHUB_HEAD_REF: ${{ github.head_ref }}" | |
echo "GITHUB_BASE_REF: ${{ github.base_ref }}" | |
echo "GITHUB_SERVER_URL: ${{ github.server_url }}" | |
echo "GITHUB_API_URL: ${{ github.api_url }}" | |
echo "GITHUB_GRAPHQL_URL: ${{ github.graphql_url }}" | |
echo "RUNNER_OS: ${{ runner.os }}" | |
echo "RUNNER_TEMP: ${{ runner.temp }}" | |
echo "RUNNER_TOOL_CACHE: ${{ runner.tool_cache }}" | |
# kit-action will automatically actions/checkout and actions/setup-node | |
- name: Set kit_tag | |
id: set_kit_tag | |
uses: johnlindquist/kit-action@main | |
with: | |
script: set-kit-tag | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Debug - Echo kit_tag | |
run: | | |
echo "kit_tag from step output: ${{ steps.set_kit_tag.outputs.result }}" | |
- name: Debug - List all step outputs | |
run: | | |
echo "All step outputs:" | |
echo "${{ toJson(steps) }}" | |
semantic: | |
outputs: | |
release_id: ${{ steps.create_release.outputs.result }} | |
semantic_version: ${{ steps.semantic.outputs.new_release_version }} | |
needs: tag | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout git repo | |
uses: actions/checkout@v4 | |
- name: Debug - Echo kit_tag from previous job | |
run: | | |
echo "kit_tag from needs.tag.outputs: ${{ needs.tag.outputs.kit_tag }}" | |
- name: Debug - List all job outputs | |
run: | | |
echo "All job outputs:" | |
echo "${{ toJson(needs) }}" | |
- name: Semantic Release | |
uses: cycjimmy/semantic-release-action@v4 | |
id: semantic # Need an `id` for output variables | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Echo kit-action version | |
run: | | |
echo "Using johnlindquist/kit-action@${{ needs.tag.outputs.kit_tag }}" | |
echo "Release Channel: ${{ steps.semantic.outputs.new_release_channel }}" | |
echo "Previous Release Channel: ${{ steps.semantic.outputs.last_release_version }}" | |
echo "Semantic Version: ${{ steps.semantic.outputs.new_release_version }}" | |
- name: Create Release | |
id: create_release | |
uses: johnlindquist/kit-action@main | |
with: | |
script: create-release ${{ steps.semantic.outputs.new_release_version }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
publish: | |
name: publish(${{ matrix.platform }}-${{ matrix.arch }}) | |
needs: [tag, semantic] | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
include: | |
- os: windows-2022 | |
platform: win32 | |
arch: arm64 | |
- os: script-kit-ubuntu-latest-arm64 | |
platform: linux | |
arch: arm64 | |
- os: windows-latest | |
platform: win32 | |
arch: x64 | |
- os: ubuntu-latest | |
platform: linux | |
arch: x64 | |
- os: macos-latest | |
platform: mac | |
arch: x64 | |
- os: macos-14 | |
platform: mac | |
arch: arm64 | |
steps: | |
- name: Debug - Echo kit_tag from previous jobs | |
run: | | |
echo "kit_tag from needs.tag.outputs: ${{ needs.tag.outputs.kit_tag }}" | |
- name: Debug - List all job outputs | |
run: | | |
echo "All job outputs:" | |
echo "${{ toJson(needs) }}" | |
- name: Checkout git repo | |
uses: actions/checkout@v4 | |
- name: Setup pnpm | |
uses: pnpm/action-setup@v4 | |
- name: Install Node, pnpm and Yarn | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20.18.0 | |
- name: Write the Semantic Version to package.json version property for main | |
if: needs.tag.outputs.kit_tag == 'latest' | |
uses: johnlindquist/kit-action@main | |
with: | |
script: update-package-version ${{ needs.semantic.outputs.semantic_version }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Nix - Write the current branch to a releaseChannel env var | |
if: ${{ matrix.os == 'ubuntu-latest' || matrix.os == 'script-kit-ubuntu-latest-arm64' }} | |
run: | | |
echo "RELEASE_CHANNEL=$(git rev-parse --abbrev-ref HEAD)" >> $GITHUB_ENV | |
- name: Windows - Write the current branch to a releaseChannel env var | |
if: ${{ matrix.os == 'windows-latest' || matrix.os == 'windows-2022' }} | |
run: | | |
echo "RELEASE_CHANNEL=$(git rev-parse --abbrev-ref HEAD)" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- name: Download kenv main | |
if: needs.tag.outputs.kit_tag == 'latest' | |
uses: johnlindquist/kit-action@main | |
with: | |
script: download-kenv ${{ env.RELEASE_CHANNEL }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Create Assets main | |
if: needs.tag.outputs.kit_tag == 'latest' | |
uses: johnlindquist/kit-action@main | |
with: | |
script: create-assets ${{ needs.semantic.outputs.semantic_version}} ${{ matrix.os }} ${{ matrix.arch }} ${{ needs.semantic.outputs.release_id }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set Optional Dependencies Based on Platform and Architecture | |
if: needs.tag.outputs.kit_tag == 'latest' | |
uses: johnlindquist/kit-action@main | |
with: | |
script: set-optional-dependencies ${{ matrix.platform }} ${{ matrix.arch }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Publish windows x64 | |
if: matrix.platform == 'win32' && matrix.arch == 'x64' | |
env: | |
APPLE_ID: ${{ secrets.APPLE_ID }} | |
APPLE_ID_PASS: ${{ secrets.APPLE_ID_PASS }} | |
CSC_LINK: ${{ secrets.CSC_LINK }} | |
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }} | |
# This is used for uploading release assets to github | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
ELECTRON_BUILD_ARCH: x64 | |
ELECTRON_BUILD_PLATFORM: win32 | |
run: | | |
pnpm i | |
cat ./package.json | |
pnpm vite-prebuild | |
pnpm exec kit ./build.ts win x64 always | |
- name: Publish windows arm64 | |
if: matrix.platform == 'win32' && matrix.arch == 'arm64' | |
run: | | |
pnpm i | |
pnpm exec kit remove-tick | |
pnpm vite-prebuild | |
pnpm exec kit ./build.ts win arm64 always | |
env: | |
# These values are used for auto updates signing | |
APPLE_ID: ${{ secrets.APPLE_ID }} | |
APPLE_ID_PASS: ${{ secrets.APPLE_ID_PASS }} | |
CSC_LINK: ${{ secrets.CSC_LINK }} | |
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }} | |
# This is used for uploading release assets to github | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
ELECTRON_BUILD_ARCH: arm64 | |
ELECTRON_BUILD_PLATFORM: win32 | |
- name: Install GCC 10 and native-keymap dependencies | |
if: matrix.platform == 'linux' | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y libxtst-dev | |
sudo apt-get install -y make gcc libpng++-dev | |
sudo apt-get install -y g++-10 | |
sudo apt-get install -y libx11-dev libxkbfile-dev | |
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 100 | |
sudo update-alternatives --set g++ /usr/bin/g++-10 | |
echo "CXX=g++-10" >> $GITHUB_ENV | |
- name: Publish linux x64 | |
if: matrix.platform == 'linux' && matrix.arch == 'x64' | |
env: | |
# These values are used for auto updates signing | |
APPLE_ID: ${{ secrets.APPLE_ID }} | |
APPLE_ID_PASS: ${{ secrets.APPLE_ID_PASS }} | |
CSC_LINK: ${{ secrets.CSC_LINK }} | |
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }} | |
# This is used for uploading release assets to github | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
ELECTRON_BUILD_ARCH: x64 | |
ELECTRON_BUILD_PLATFORM: linux | |
run: | | |
node --version | |
pnpm --version | |
pnpm i | |
cat ./package.json | |
pnpm vite-prebuild | |
pnpm exec kit ./build.ts linux x64 always | |
- name: Publish linux arm64 | |
if: matrix.platform == 'linux' && matrix.arch == 'arm64' | |
env: | |
# These values are used for auto updates signing | |
APPLE_ID: ${{ secrets.APPLE_ID }} | |
APPLE_ID_PASS: ${{ secrets.APPLE_ID_PASS }} | |
CSC_LINK: ${{ secrets.CSC_LINK }} | |
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }} | |
# This is used for uploading release assets to github | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
ELECTRON_BUILD_ARCH: arm64 | |
ELECTRON_BUILD_PLATFORM: linux | |
run: | | |
sudo apt-get install ruby ruby-dev rubygems build-essential | |
sudo gem install --no-document fpm | |
export USE_SYSTEM_FPM=true | |
node --version | |
pnpm --version | |
pnpm i | |
pnpm exec kit remove-tick | |
cat ./package.json | |
pnpm vite-prebuild | |
which npm | |
pnpm --version | |
pnpm exec kit ./build.ts linux arm64 always | |
- name: Publish mac x64 | |
if: matrix.platform == 'mac' && matrix.arch == 'x64' | |
env: | |
# These values are used for auto updates signing | |
APPLE_API_KEY: ${{ secrets.APPLE_API_KEY }} | |
APPLE_API_KEY_ID: ${{ secrets.APPLE_API_KEY_ID }} | |
APPLE_ID: ${{ secrets.APPLE_ID }} | |
APPLE_ID_PASS: ${{ secrets.APPLE_ID_PASS }} | |
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} | |
CSC_LINK: ${{ secrets.CSC_LINK }} | |
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }} | |
APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }} | |
# This is used for uploading release assets to github | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
ELECTRON_BUILD_ARCH: x64 | |
ELECTRON_BUILD_PLATFORM: darwin | |
# Wait 5 minutes to start to avoid signing issues | |
run: | | |
sleep 300 | |
pnpm i | |
pnpm vite-prebuild | |
pnpm exec kit ./build.ts mac ${{ matrix.arch }} always | |
- name: Publish mac arm64 | |
if: matrix.platform == 'mac' && matrix.arch == 'arm64' | |
env: | |
# These values are used for auto updates signing | |
APPLE_API_KEY: ${{ secrets.APPLE_API_KEY }} | |
APPLE_API_KEY_ID: ${{ secrets.APPLE_API_KEY_ID }} | |
APPLE_ID: ${{ secrets.APPLE_ID }} | |
APPLE_ID_PASS: ${{ secrets.APPLE_ID_PASS }} | |
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }} | |
CSC_LINK: ${{ secrets.CSC_LINK }} | |
CSC_KEY_PASSWORD: ${{ secrets.CSC_KEY_PASSWORD }} | |
APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }} | |
# This is used for uploading release assets to github | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
ELECTRON_BUILD_ARCH: arm64 | |
ELECTRON_BUILD_PLATFORM: darwin | |
run: | | |
pnpm i | |
pnpm vite-prebuild | |
pnpm exec kit ./build.ts mac ${{ matrix.arch }} always | |
- name: Merge latest-mac.yml and latest-mac-arm64.yml | |
if: matrix.platform == 'mac' | |
# Just something to keep an eye on in case kit-action changes. | |
uses: johnlindquist/kit-action@main | |
with: | |
script: merge-mac-latest-yml script-kit kitapp ${{ matrix.arch }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |