Skip to content

fix(robot): switching from enigo to robotjs. WIP #2108

fix(robot): switching from enigo to robotjs. WIP

fix(robot): switching from enigo to robotjs. WIP #2108

Workflow file for this run

name: Publish
on:
push:
branches:
- main
- next
workflow_dispatch:
branches:
- main
- next
jobs:
tag:
outputs:
kit_tag: ${{ steps.set_kit_tag.outputs.kit_tag }}
runs-on: ubuntu-latest
steps:
- name: Set kit_tag to next or main
id: set_kit_tag
run: |
echo "Determining the kit_tag based on the branch name..."
if [ "${{ github.ref_name }}" = "main" ]; then
echo "Branch is 'main'. Setting kit_tag to 'latest'."
echo "kit_tag=latest" >> $GITHUB_OUTPUT
else
echo "Branch is not 'main'. Assuming it's 'next'. Setting kit_tag to 'next'."
echo "kit_tag=next" >> $GITHUB_OUTPUT
fi
echo "kit_tag has been set successfully."
semantic:
outputs:
release_id: ${{ steps.set_release_id.outputs.release_id }}
semantic_version: ${{ steps.semantic_version.outputs.semantic_version }}
needs: tag
runs-on: ubuntu-latest
steps:
- name: Checkout git repo
uses: actions/checkout@v4
- name: Semantic Release
uses: cycjimmy/semantic-release-action@v4
id: semantic # Need an `id` for output variables
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Verify that Semantic Release updated package.json
id: semantic_version
run: |
cat package.json
echo "semantic_version=${{ steps.semantic.outputs.new_release_version }}" >> $GITHUB_OUTPUT
- name: Create Release main
if: needs.tag.outputs.kit_tag == 'main'
id: create_release_main
uses: johnlindquist/kit-action@main
with:
script: create-release ${{ steps.semantic.outputs.new_release_version }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Release next
if: needs.tag.outputs.kit_tag == 'next'
id: create_release_next
uses: johnlindquist/kit-action@next
with:
script: create-release ${{ steps.semantic.outputs.new_release_version }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Set release_id output from create_release_main or create_release_next
id: set_release_id
run: |
echo "Determining release_id based on the workflow step outputs..."
if [ -n "${{ steps.create_release_main.outputs.result }}" ]; then
echo "Found release_id from 'create_release_main': ${{ steps.create_release_main.outputs.result }}."
echo "release_id=${{ steps.create_release_main.outputs.result }}" >> $GITHUB_OUTPUT
elif [ -n "${{ steps.create_release_next.outputs.result }}" ]; then
echo "Found release_id from 'create_release_next': ${{ steps.create_release_next.outputs.result }}."
echo "release_id=${{ steps.create_release_next.outputs.result }}" >> $GITHUB_OUTPUT
else
echo "Failed to determine release_id from the workflow step outputs."
exit 1
fi
publish:
needs: [tag, semantic]
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-13, windows-latest, ubuntu-latest]
arch: [x64, arm64]
node: [20.11.1]
steps:
- name: Print outputs from previous steps
run: |
echo "kit_tag: ${{ needs.tag.outputs.kit_tag }}"
echo "release_id: ${{ needs.semantic.outputs.release_id }}"
echo "semantic_version: ${{ needs.semantic.outputs.semantic_version }}"
- name: Checkout git repo
uses: actions/checkout@v4
- name: Write the Semantic Version to package.json version property for main
if: needs.tag.outputs.kit_tag == 'main'
uses: johnlindquist/kit-action@main
with:
script: update-package-version ${{ needs.semantic.outputs.semantic_version }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Write the Semantic Version to package.json version property for next
if: needs.tag.outputs.kit_tag == 'next'
uses: johnlindquist/kit-action@next
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 != 'windows-latest' }}
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' }}
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 == 'main'
uses: johnlindquist/kit-action@main
with:
script: download-kenv ${{ env.RELEASE_CHANNEL }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Download kenv next
if: needs.tag.outputs.kit_tag == 'next'
uses: johnlindquist/kit-action@next
with:
script: download-kenv ${{ env.RELEASE_CHANNEL }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Create Assets main
if: needs.tag.outputs.kit_tag == 'main'
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: Create Assets next
if: needs.tag.outputs.kit_tag == 'next'
uses: johnlindquist/kit-action@next
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: Install Node, NPM and Yarn
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
# - name: Ubuntu Electron Issue
# if: matrix.os == 'ubuntu-latest'
# run: echo "There is an issue with electron >=26 with something in the app causing a crash. It might be with the powerMonitor, but it's still not clear. This will have to be resolved before we can upgrade electron and move to ESM-only."
# env:
# KIT_TAG: ${{ needs.tag.outputs.kit_tag }}
# # - name: npm i --force @johnlindquist/kit
# # if: matrix.os == 'ubuntu-latest'
# # run: |
# # # npm i --force
# # npm i --force electron@25.9.3
# # npm i --force "@johnlindquist/kit@${{ env.KIT_TAG }}"
- name: Publish windows x64
if: matrix.os == 'windows-latest' && 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 }}
uses: nick-invision/retry@v3
with:
max_attempts: 3
timeout_minutes: 30
command: |
npm un --force node-mac-permissions @johnlindquist/mac-clipboard-listener @johnlindquist/mac-frontmost @johnlindquist/mac-panel-window
npm i --force @johnlindquist/kit@${{ needs.tag.outputs.kit_tag }}
npm i --force
npx kit remove-mac
Push-Location node_modules\uiohook-napi\prebuilds; Get-ChildItem | Where-Object { $_.Name -notmatch '^win' } | Remove-Item -Recurse -Force; Pop-Location
if (Test-Path node_modules\@nut-tree\libnut-darwin) { Remove-Item node_modules\@nut-tree\libnut-darwin -Recurse -Force }
if (Test-Path node_modules\@nut-tree\libnut-linux) { Remove-Item node_modules\@nut-tree\libnut-linux -Recurse -Force }
cat ./package.json
echo "--- Done removing mac deps ---\n\n"
npm run vite-prebuild
npx kit ./build.ts win x64 always
- name: Publish windows arm64
if: matrix.os == 'windows-latest' && matrix.arch == 'arm64'
uses: nick-invision/retry@v3
with:
max_attempts: 3
timeout_minutes: 30
command: |
npm un --force node-mac-permissions @nut-tree/nut-js uiohook-napi @johnlindquist/mac-clipboard-listener @johnlindquist/mac-frontmost @johnlindquist/mac-panel-window
npm i --force @johnlindquist/kit@${{ needs.tag.outputs.kit_tag }}
npm i --force
npx kit remove-tick
npx kit remove-mac
npx kit remove-nut
echo "--- Done removing mac deps ---\n\n"
npm run vite-prebuild
npx 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 }}
- name: Publish linux x64
if: matrix.os == 'ubuntu-latest' && 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 }}
uses: nick-invision/retry@v3
with:
max_attempts: 3
timeout_minutes: 30
command: |
npm un --force node-mac-permissions @johnlindquist/mac-clipboard-listener @johnlindquist/mac-frontmost @johnlindquist/mac-panel-window @johnlindquist/node-window-manager
npm i --force @johnlindquist/kit@${{ needs.tag.outputs.kit_tag }}
npm i --force
npx kit remove-mac
npx kit remove-node-window-manager
# npx kit patch-node-pty
# npm i --force @homebridge/node-pty-prebuilt-multiarch
cat ./package.json
echo "--- Done removing mac deps ---\n\n"
npm run vite-prebuild
npx kit ./build.ts linux x64 always
- name: Publish linux arm64
if: matrix.os == 'ubuntu-latest' && 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 }}
uses: nick-invision/retry@v3
with:
max_attempts: 3
timeout_minutes: 30
command: |
npm un --force node-mac-permissions @nut-tree/nut-js uiohook-napi @johnlindquist/mac-clipboard-listener @johnlindquist/mac-frontmost @johnlindquist/mac-panel-window @johnlindquist/node-window-manager
npm i --force @johnlindquist/kit@${{ needs.tag.outputs.kit_tag }}
npm i --force
npx kit remove-tick
npx kit remove-mac
npx kit remove-nut
npx kit remove-node-window-manager
# npx kit patch-node-pty
# npm i --force @homebridge/node-pty-prebuilt-multiarch
cat ./package.json
echo "--- Done removing mac deps ---\n\n"
npm run vite-prebuild
npx kit ./build.ts linux arm64 always
- name: Publish mac x64
if: matrix.os == 'macos-13' && 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 }}
APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }}
# This is used for uploading release assets to github
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: nick-invision/retry@v3
with:
max_attempts: 3
timeout_minutes: 30
command: |
npm i --force @johnlindquist/kit@${{ needs.tag.outputs.kit_tag }}
npm i --force
npm run vite-prebuild
npx kit ./build.ts mac x64 always
- name: Publish mac arm64
if: matrix.os == 'macos-13' && 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 }}
APPLE_APP_SPECIFIC_PASSWORD: ${{ secrets.APPLE_APP_SPECIFIC_PASSWORD }}
# This is used for uploading release assets to github
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
uses: nick-invision/retry@v3
with:
max_attempts: 3
timeout_minutes: 30
command: |
npm i --force @johnlindquist/kit@${{ needs.tag.outputs.kit_tag }}
npm i --force
npm run vite-prebuild
npx kit ./build.ts mac arm64 always
- name: Merge latest-mac.yml and latest-mac-arm64.yml with main
if: matrix.os == 'macos-13' && needs.tag.outputs.kit_tag == 'main'
uses: johnlindquist/kit-action@main
with:
script: merge-mac-latest-yml johnlindquist kitapp ${{ matrix.arch }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Merge latest-mac.yml and latest-mac-arm64.yml with next
if: matrix.os == 'macos-13' && needs.tag.outputs.kit_tag == 'next'
uses: johnlindquist/kit-action@next
with:
script: merge-mac-latest-yml johnlindquist kitapp ${{ matrix.arch }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}