Skip to content

A local-first personal finance app

[AI] Consolidate npm release and nightly publishing into one workflow (#7583)

Copilot1c973886548c
diff --git a/.github/actions/setup/action.yml b/.github/actions/setup/action.yml
index e6f381bc4e..c313fa3365 100644
--- a/.github/actions/setup/action.yml
+++ b/.github/actions/setup/action.yml
@@ -53,8 +53,8 @@ runs:
repository: actualbudget/translations
path: ${{ inputs.working-directory }}/packages/desktop-client/locale
persist-credentials: false
- if: ${{ inputs.download-translations == 'true' }}
+ if: ${{ inputs.download-translations == 'true' && !env.ACT }}
- name: Remove untranslated languages
run: packages/desktop-client/bin/remove-untranslated-languages
shell: bash
- if: ${{ inputs.download-translations == 'true' }}
+ if: ${{ inputs.download-translations == 'true' && !env.ACT }}
diff --git a/.github/workflows/publish-nightly-npm-packages.yml b/.github/workflows/publish-nightly-npm-packages.yml
deleted file mode 100644
index 3a857abc6e..0000000000
--- a/.github/workflows/publish-nightly-npm-packages.yml
+++ /dev/null
@@ -1,118 +0,0 @@
-name: Publish nightly npm packages
-
-# Nightly npm packages are built daily at midnight UTC
-on:
- schedule:
- - cron: '0 0 * * *'
- workflow_dispatch:
-
-jobs:
- build-and-pack:
- runs-on: ubuntu-latest
- name: Build and pack npm packages
- if: github.event.repository.fork == false
- steps:
- - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- with:
- persist-credentials: false
-
- - name: Set up environment
- uses: ./.github/actions/setup
-
- - name: Update package versions
- run: |
- # Get new nightly versions
- NEW_CORE_VERSION=$(yarn workspace @actual-app/ci-actions tsx bin/get-next-package-version.ts --package-json ./packages/loot-core/package.json --type nightly)
- NEW_WEB_VERSION=$(yarn workspace @actual-app/ci-actions tsx bin/get-next-package-version.ts --package-json ./packages/desktop-client/package.json --type nightly)
- NEW_SYNC_VERSION=$(yarn workspace @actual-app/ci-actions tsx bin/get-next-package-version.ts --package-json ./packages/sync-server/package.json --type nightly)
- NEW_API_VERSION=$(yarn workspace @actual-app/ci-actions tsx bin/get-next-package-version.ts --package-json ./packages/api/package.json --type nightly)
- NEW_CLI_VERSION=$(yarn workspace @actual-app/ci-actions tsx bin/get-next-package-version.ts --package-json ./packages/cli/package.json --type nightly)
-
- # Set package versions
- npm version $NEW_CORE_VERSION --no-git-tag-version --workspace=@actual-app/core --no-workspaces-update
- npm version $NEW_WEB_VERSION --no-git-tag-version --workspace=@actual-app/web --no-workspaces-update
- npm version $NEW_SYNC_VERSION --no-git-tag-version --workspace=@actual-app/sync-server --no-workspaces-update
- npm version $NEW_API_VERSION --no-git-tag-version --workspace=@actual-app/api --no-workspaces-update
- npm version $NEW_CLI_VERSION --no-git-tag-version --workspace=@actual-app/cli --no-workspaces-update
-
- - name: Yarn install
- run: |
- yarn install
-
- - name: Pack the core package
- run: |
- yarn workspace @actual-app/core pack --filename @actual-app/core.tgz
-
- - name: Build Server & Web
- run: yarn build:server
-
- - name: Pack the web and server packages
- run: |
- yarn workspace @actual-app/web pack --filename @actual-app/web.tgz
- yarn workspace @actual-app/sync-server pack --filename @actual-app/sync-server.tgz
-
- - name: Build API
- run: yarn build:api
-
- - name: Pack the api package
- run: |
- yarn workspace @actual-app/api pack --filename @actual-app/api.tgz
-
- - name: Build CLI
- run: yarn workspace @actual-app/cli build
-
- - name: Pack the cli package
- run: |
- yarn workspace @actual-app/cli pack --filename @actual-app/cli.tgz
-
- - name: Upload package artifacts
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
- with:
- name: npm-packages
- path: |
- packages/loot-core/@actual-app/core.tgz
- packages/desktop-client/@actual-app/web.tgz
- packages/sync-server/@actual-app/sync-server.tgz
- packages/api/@actual-app/api.tgz
- packages/cli/@actual-app/cli.tgz
-
- publish:
- runs-on: ubuntu-latest
- name: Publish Nightly npm packages
- needs: build-and-pack
- permissions:
- contents: read
- packages: write
- id-token: write # Required for OIDC
- steps:
- - name: Download the artifacts
- uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
- with:
- name: npm-packages
-
- - name: Setup node and npm registry
- uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
- with:
- node-version: 24
- check-latest: true
- registry-url: 'https://registry.npmjs.org'
-
- - name: Publish Core
- run: |
- npm publish loot-core/@actual-app/core.tgz --access public --tag nightly
-
- - name: Publish Web
- run: |
- npm publish desktop-client/@actual-app/web.tgz --access public --tag nightly
-
- - name: Publish Sync-Server
- run: |
- npm publish sync-server/@actual-app/sync-server.tgz --access public --tag nightly
-
- - name: Publish API
- run: |
- npm publish api/@actual-app/api.tgz --access public --tag nightly
-
- - name: Publish CLI
- run: |
- npm publish cli/@actual-app/cli.tgz --access public --tag nightly
diff --git a/.github/workflows/publish-npm-packages.yml b/.github/workflows/publish-npm-packages.yml
index 7e00121b2e..85446e80be 100644
--- a/.github/workflows/publish-npm-packages.yml
+++ b/.github/workflows/publish-npm-packages.yml
@@ -1,15 +1,19 @@
name: Publish npm packages
-# # Npm packages are published for every new tag
+# Npm packages are published for every new tag and nightly schedule
on:
push:
tags:
- 'v*.*.*'
+ schedule:
+ - cron: '0 0 * * *'
+ workflow_dispatch:
jobs:
build-and-pack:
runs-on: ubuntu-latest
name: Build and pack npm packages
+ if: github.event_name == 'push' || (github.event.repository.fork == false)
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
@@ -18,11 +22,34 @@ jobs:
- name: Set up environment
uses: ./.github/actions/setup
+ - name: Update package versions
+ if: github.event_name != 'push'
+ run: |
+ # Get new nightly versions
+ NEW_CORE_VERSION=$(yarn workspace @actual-app/ci-actions tsx bin/get-next-package-version.ts --package-json ./packages/loot-core/package.json --type nightly)
+ NEW_WEB_VERSION=$(yarn workspace @actual-app/ci-actions tsx bin/get-next-package-version.ts --package-json ./packages/desktop-client/package.json --type nightly)
+ NEW_SYNC_VERSION=$(yarn workspace @actual-app/ci-actions tsx bin/get-next-package-version.ts --package-json ./packages/sync-server/package.json --type nightly)
+ NEW_API_VERSION=$(yarn workspace @actual-app/ci-actions tsx bin/get-next-package-version.ts --package-json ./packages/api/package.json --type nightly)
+ NEW_CLI_VERSION=$(yarn workspace @actual-app/ci-actions tsx bin/get-next-package-version.ts --package-json ./packages/cli/package.json --type nightly)
+
+ # Set package versions
+ npm version $NEW_CORE_VERSION --no-git-tag-version --workspace=@actual-app/core --no-workspaces-update
+ npm version $NEW_WEB_VERSION --no-git-tag-version --workspace=@actual-app/web --no-workspaces-update
+ npm version $NEW_SYNC_VERSION --no-git-tag-version --workspace=@actual-app/sync-server --no-workspaces-update
+ npm version $NEW_API_VERSION --no-git-tag-version --workspace=@actual-app/api --no-workspaces-update
+ npm version $NEW_CLI_VERSION --no-git-tag-version --workspace=@actual-app/cli --no-workspaces-update
+
+ - name: Yarn install
+ if: github.event_name != 'push'
+ run: |
+ # Required after nightly `npm version` updates workspace manifests.
+ yarn install
+
- name: Pack the core package
run: |
yarn workspace @actual-app/core pack --filename @actual-app/core.tgz
- - name: Build Web
+ - name: Build Server & Web
run: yarn build:server
- name: Pack the web and server packages
@@ -46,6 +73,7 @@ jobs:
- name: Upload package artifacts
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
+ if: ${{ !env.ACT }}
with:
name: npm-packages
path: |
@@ -63,6 +91,8 @@ jobs:
contents: read
packages: write
id-token: write # Required for OIDC
+ env:
+ NPM_DIST_TAG: ${{ github.event_name != 'push' && 'nightly' || '' }}
steps:
- name: Download the artifacts
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
@@ -78,20 +108,20 @@ jobs:
- name: Publish Core
run: |
- npm publish loot-core/@actual-app/core.tgz --access public
+ npm publish loot-core/@actual-app/core.tgz --access public ${NPM_DIST_TAG:+--tag "$NPM_DIST_TAG"}
- name: Publish Web
run: |
- npm publish desktop-client/@actual-app/web.tgz --access public
+ npm publish desktop-client/@actual-app/web.tgz --access public ${NPM_DIST_TAG:+--tag "$NPM_DIST_TAG"}
- name: Publish Sync-Server
run: |
- npm publish sync-server/@actual-app/sync-server.tgz --access public
+ npm publish sync-server/@actual-app/sync-server.tgz --access public ${NPM_DIST_TAG:+--tag "$NPM_DIST_TAG"}
- name: Publish API
run: |
- npm publish api/@actual-app/api.tgz --access public
+ npm publish api/@actual-app/api.tgz --access public ${NPM_DIST_TAG:+--tag "$NPM_DIST_TAG"}
- name: Publish CLI
run: |
- npm publish cli/@actual-app/cli.tgz --access public
+ npm publish cli/@actual-app/cli.tgz --access public ${NPM_DIST_TAG:+--tag "$NPM_DIST_TAG"}
diff --git a/upcoming-release-notes/7583.md b/upcoming-release-notes/7583.md
new file mode 100644
index 0000000000..e554a48429
--- /dev/null
+++ b/upcoming-release-notes/7583.md
@@ -0,0 +1,6 @@
+---
+category: Maintenance
+authors: [jfdoming]
+---
+
+Consolidate release and nightly npm publishing workflow