diff --git a/.github/actions/set-npm-token/action.yml b/.github/actions/set-npm-token/action.yml deleted file mode 100644 index ef0941cdcd3..00000000000 --- a/.github/actions/set-npm-token/action.yml +++ /dev/null @@ -1,15 +0,0 @@ -name: 'Set NPM Token' -description: 'Set NPM authentication token in .npmrc file' - -inputs: - token-secret: - description: 'Name of the GitHub secret containing the NPM token' - required: true - -runs: - using: 'composite' - steps: - - name: Set npm token - shell: bash - run: | - echo "//registry.npmjs.org/:_authToken=${{ inputs.token-secret }}" > .npmrc diff --git a/.github/actions/yarn/action.yml b/.github/actions/yarn/action.yml index 2aa211a518b..3f718f6888a 100644 --- a/.github/actions/yarn/action.yml +++ b/.github/actions/yarn/action.yml @@ -8,6 +8,7 @@ runs: uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0 with: node-version-file: .nvmrc + registry-url: 'https://registry.npmjs.org' - name: Enable Corepack and prepare Yarn 4 run: corepack enable shell: bash diff --git a/.github/workflows/deploy-alpha.yml b/.github/workflows/deploy-alpha.yml index 909cedb8c1e..b61b60367f0 100644 --- a/.github/workflows/deploy-alpha.yml +++ b/.github/workflows/deploy-alpha.yml @@ -28,11 +28,6 @@ jobs: id: setup uses: ./.github/actions/yarn - - name: Add NPM auth token file - uses: ./.github/actions/set-npm-token - with: - token-secret: ${{ secrets.NPM_TOKEN }} - - name: Ensure workflow is associated with a pull request uses: ./.github/actions/validate-pr-context diff --git a/.github/workflows/publish-production.yml b/.github/workflows/publish-production.yml deleted file mode 100644 index 8fdfcc3b166..00000000000 --- a/.github/workflows/publish-production.yml +++ /dev/null @@ -1,67 +0,0 @@ -name: Publish Production - -on: - push: - branches: - - main - -env: - NODE_VERSION: '22.13.1' - NODE_OPTIONS: '--max_old_space_size=8196' - NX_CLOUD: false - IGNORE_COMMIT_MESSAGE: 'chore(release): publish' - -permissions: - id-token: write - contents: write - pull-requests: write - issues: write - -concurrency: - group: publish-production - cancel-in-progress: false - -jobs: - publish: - runs-on: ubuntu-22.04 - timeout-minutes: 30 - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - token: ${{ secrets.ACTIONS_GITHUB_TOKEN }} - - - name: Skip build from automated commit - uses: ./.github/actions/skip-automated-commits - with: - ignore-commit-message: ${{ env.IGNORE_COMMIT_MESSAGE }} - - - name: Setup and Build - uses: ./.github/actions/yarn - - - name: Cache Nx - uses: actions/cache@v4 - with: - path: node_modules/.cache/nx - key: nx-${{ runner.os }}-${{ hashFiles('yarn.lock') }}-${{ github.ref_name }}-${{ github.run_id }} - restore-keys: | - nx-${{ runner.os }}-${{ hashFiles('yarn.lock') }}-${{ github.ref_name }}- - nx-${{ runner.os }}-${{ hashFiles('yarn.lock') }}- - nx-${{ runner.os }}- - - - name: Set git user - uses: ./.github/actions/set-git-user - - - name: Set npm token - uses: ./.github/actions/set-npm-token - with: - token-secret: ${{ secrets.NODE_AUTH_TOKEN }} - - - name: Build All Packages - run: yarn build - - - name: NX Release - run: npx nx release -y - env: - GH_TOKEN: ${{ secrets.ACTIONS_GITHUB_TOKEN }} - NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }} diff --git a/.github/workflows/publish-alpha.yml b/.github/workflows/publish.yml similarity index 64% rename from .github/workflows/publish-alpha.yml rename to .github/workflows/publish.yml index b1d926c845c..3ccf594f562 100644 --- a/.github/workflows/publish-alpha.yml +++ b/.github/workflows/publish.yml @@ -1,8 +1,11 @@ -name: Publish Alpha +name: Publish on: pull_request: types: [opened, synchronize, reopened] + push: + branches: + - main env: NODE_VERSION: '22.13.1' @@ -10,21 +13,24 @@ env: NX_CLOUD: false IGNORE_COMMIT_MESSAGE: 'chore(release): publish' -permissions: - id-token: write - contents: read - pull-requests: write - issues: write - actions: write - jobs: publish-alpha: + if: github.event_name == 'pull_request' runs-on: ubuntu-22.04 + concurrency: + group: publish-alpha-${{ github.event.pull_request.number }} + cancel-in-progress: true + permissions: + id-token: write + contents: read + pull-requests: write + issues: write + actions: write steps: - uses: actions/checkout@v4 with: fetch-depth: 0 - ref: ${{ github.event.pull_request.head.ref }} + ref: ${{ github.event.pull_request.head.ref }} - name: Setup and Build id: setup @@ -33,11 +39,6 @@ jobs: - name: Set git user uses: ./.github/actions/set-git-user - - name: Set npm token - uses: ./.github/actions/set-npm-token - with: - token-secret: ${{ secrets.NODE_AUTH_TOKEN }} - - name: Ensure workflow is associated with a pull request uses: ./.github/actions/validate-pr-context @@ -56,7 +57,6 @@ jobs: npx nx run gamut-release:alpha --preid="${PREID}" --manifest env: GH_TOKEN: ${{ secrets.ACTIONS_GITHUB_TOKEN }} - NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }} - name: List alpha packages versions id: published @@ -108,3 +108,50 @@ jobs: github-token: ${{ secrets.ACTIONS_GITHUB_TOKEN }} header: Alpha Packages message-path: alpha-publish-comment.md + + publish-production: + if: github.event_name == 'push' && github.ref == 'refs/heads/main' + runs-on: ubuntu-22.04 + timeout-minutes: 30 + concurrency: + group: publish-production + cancel-in-progress: false + permissions: + id-token: write + contents: write + pull-requests: write + issues: write + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + token: ${{ secrets.ACTIONS_GITHUB_TOKEN }} + + - name: Skip build from automated commit + uses: ./.github/actions/skip-automated-commits + with: + ignore-commit-message: ${{ env.IGNORE_COMMIT_MESSAGE }} + + - name: Setup and Build + uses: ./.github/actions/yarn + + - name: Cache Nx + uses: actions/cache@v4 + with: + path: node_modules/.cache/nx + key: nx-${{ runner.os }}-${{ hashFiles('yarn.lock') }}-${{ github.ref_name }}-${{ github.run_id }} + restore-keys: | + nx-${{ runner.os }}-${{ hashFiles('yarn.lock') }}-${{ github.ref_name }}- + nx-${{ runner.os }}-${{ hashFiles('yarn.lock') }}- + nx-${{ runner.os }}- + + - name: Set git user + uses: ./.github/actions/set-git-user + + - name: Build All Packages + run: yarn build + + - name: NX Release + run: npx nx release -y + env: + GH_TOKEN: ${{ secrets.ACTIONS_GITHUB_TOKEN }}