Skip to content

[Nightly] - Build & Publish - Scheduled #1672

[Nightly] - Build & Publish - Scheduled

[Nightly] - Build & Publish - Scheduled #1672

name: "[Nightly] - Build & Publish - Scheduled"
on:
schedule:
- cron: "0 2 * * TUE-SAT" # At 02:00 on Tuesday, Wednesday, Thursday, Friday and Saturday (UTC)
workflow_dispatch:
permissions:
contents: read
id-token: write
jobs:
nightly-release:
name: Nightly Release
runs-on: ledger-live-linux-8CPU-32RAM
env:
NODE_OPTIONS: "--max-old-space-size=7168"
steps:
- name: generate token
id: generate-token
uses: actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf # 2.2.1
with:
app-id: ${{ secrets.GH_BOT_APP_ID }}
private-key: ${{ secrets.GH_BOT_PRIVATE_KEY }}
repositories: |
ledger-live
ledger-live-build
- name: Checkout Repo
uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
with:
ref: develop
fetch-depth: 1
token: ${{ steps.generate-token.outputs.token }}
- name: Get checked out commit SHA
id: get-sha
run: echo "sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
shell: bash
- name: Setup git user
uses: LedgerHQ/ledger-live/tools/actions/composites/setup-git-user@develop
- name: Setup the caches
uses: LedgerHQ/ledger-live/tools/actions/composites/setup-caches@develop
id: setup-caches
with:
use-mise: true
gh-token: ${{ secrets.GITHUB_TOKEN }}
skip-nx-cache: "true"
- uses: ruby/setup-ruby@95ef2b042f9d7a56d8268cba8559e2842e2ad01b # v1
with:
ruby-version: 3.3.0
- name: JFrog npm auth
uses: LedgerHQ/ledger-live/tools/actions/composites/jfrog-npm-auth@develop
with:
registry: ${{ vars.ARTIFACTORY_URL }}
- name: install dependencies
run: pnpm i -F "ledger-live" -F "{libs/**}..." -F "@ledgerhq/live-cli"
- name: build libs
run: pnpm exec nx run-many -t build --projects=tag:scope:libs
- name: snapshot versioning
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: pnpm changeset version --snapshot nightly
- uses: LedgerHQ/ledger-live/tools/actions/get-package-infos@develop
id: post-wallet-cli-version
with:
path: ${{ github.workspace }}/apps/wallet-cli
#JFrog publishing - if statements to be removed when all is migrated
- name: JFrog npm auth (publish registry)
if: ${{ vars.ARTIFACTORY_PUBLISH_URL != '' }}
uses: LedgerHQ/ledger-live/tools/actions/composites/jfrog-npm-auth@develop
with:
registry: ${{ vars.ARTIFACTORY_PUBLISH_URL }}
- name: publish nightly (JFrog)
if: ${{ vars.ARTIFACTORY_PUBLISH_URL != '' }}
run: npm_config_registry="https://${{ vars.ARTIFACTORY_PUBLISH_URL }}/" pnpm changeset publish --tag nightly --no-git-tag
#NPM publishing - to be removed when all is migrated
- name: authenticate with npm
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4
if: ${{ vars.ARTIFACTORY_PUBLISH_URL == '' }}
with:
registry-url: "https://registry.npmjs.org"
- name: publish nightly
run: pnpm changeset publish --tag nightly --no-git-tag
if: ${{ vars.ARTIFACTORY_PUBLISH_URL == '' }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPMJS_TOKEN }}
#NPM publishing - end removal
- uses: LedgerHQ/ledger-live/tools/actions/get-package-infos@develop
id: post-desktop-version
with:
path: ${{ github.workspace }}/apps/ledger-live-desktop
- uses: LedgerHQ/ledger-live/tools/actions/get-package-infos@develop
id: post-mobile-version
with:
path: ${{ github.workspace }}/apps/ledger-live-mobile
- name: tag nightly ref
uses: LedgerHQ/ledger-live/tools/actions/composites/create-or-update-tag@develop
with:
ref: ${{ steps.get-sha.outputs.sha }}
tagName: nightly
token: ${{ steps.generate-token.outputs.token }}
overwrite: true
- uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
name: trigger nightly build of desktop
with:
github-token: ${{ steps.generate-token.outputs.token }}
script: |
github.rest.actions.createWorkflowDispatch({
owner: "ledgerhq",
repo: "ledger-live-build",
ref: "main",
workflow_id: "nightly-desktop.yml",
inputs: {
version_override: "${{ steps.post-desktop-version.outputs.version }}"
}
});
- uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
name: trigger nightly build of mobile
with:
github-token: ${{ steps.generate-token.outputs.token }}
script: |
github.rest.actions.createWorkflowDispatch({
owner: "ledgerhq",
repo: "ledger-live-build",
ref: "main",
workflow_id: "nightly-mobile.yml",
inputs: {
version_override: "${{ steps.post-mobile-version.outputs.version }}"
}
});
- uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
name: trigger nightly wallet-cli sign and JFrog publish
with:
github-token: ${{ steps.generate-token.outputs.token }}
script: |
github.rest.actions.createWorkflowDispatch({
owner: "ledgerhq",
repo: "ledger-live-build",
ref: "main",
workflow_id: "nightly-wallet-cli.yml",
inputs: {
ref: "${{ steps.get-sha.outputs.sha }}",
version_override: "${{ steps.post-wallet-cli-version.outputs.version }}",
publish_to_jfrog: "true",
jfrog_registry: "jfrog.ledgerlabs.net/artifactory/api/npm/ledgerlive-npm-prod-public"
}
});
nightly-fail:
name: Nightly Release > Failure Reporting
needs: nightly-release
if: failure()
runs-on: ubuntu-latest
steps:
- name: post to a Slack channel
id: slack
uses: slackapi/slack-github-action@dcb1066f776dd043e64d0e8ba94ca15cc7e1875d # v4.0.0
with:
token: ${{ secrets.SLACK_BOT_USER_OAUTH_ACCESS_TOKEN }}
method: chat.postMessage
payload: |
channel: "C08JQKWS9KK"
text: "[Alert] Nightly Release failed"
blocks:
- type: "section"
text:
type: "mrkdwn"
text: "*Nightly Release failed*"
- type: "section"
text:
type: "mrkdwn"
text: "<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|Workflow run>"