From 97b0580189751ee236562cfcd22af26cf171b122 Mon Sep 17 00:00:00 2001 From: Vlad Frangu Date: Wed, 15 Oct 2025 08:46:33 +0300 Subject: [PATCH] chore: oidc unification --- .../create-pr-for-release-and-publish.yml | 43 +++++++++++++++ .github/workflows/publish-next.yml | 52 ------------------- 2 files changed, 43 insertions(+), 52 deletions(-) delete mode 100644 .github/workflows/publish-next.yml diff --git a/.github/workflows/create-pr-for-release-and-publish.yml b/.github/workflows/create-pr-for-release-and-publish.yml index 4bd4e858..23235436 100644 --- a/.github/workflows/create-pr-for-release-and-publish.yml +++ b/.github/workflows/create-pr-for-release-and-publish.yml @@ -10,6 +10,49 @@ on: - cron: '0 12 * * 1,4' jobs: + publish_next: + concurrency: + group: publish_next + cancel-in-progress: true + + name: Publish @next release to npm + + runs-on: ubuntu-latest + + permissions: + id-token: write + + if: github.repository_owner == 'discordjs' && github.event_name == 'push' && !startsWith(github.event.head_commit.message, 'chore(release)') + + steps: + - name: Checkout repository + uses: actions/checkout@v5 + with: + fetch-depth: 0 + + - name: Use Node.js + uses: actions/setup-node@v5 + with: + cache: 'yarn' + node-version-file: package.json + + - name: Install Dependencies + run: yarn + + - name: Bump version + run: node ./scripts/bump-version.mjs + + # TODO: we need a scoped token for this -.-, can't OIDC tmk + # - name: Deprecate old @next versions + # run: yarn npm-deprecate --name "*next*" --package discord-api-types --message "No longer supported. Install the latest @next release" || true + # env: + # NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }} + + - name: Publish new @next version + run: | + yarn version $(jq --raw-output '.version' package.json)-next.$(git rev-parse --short HEAD).$(date +%s) + yarn npm publish --tag next + create_pr: name: Create PR for new version runs-on: ubuntu-latest diff --git a/.github/workflows/publish-next.yml b/.github/workflows/publish-next.yml deleted file mode 100644 index a321e7a7..00000000 --- a/.github/workflows/publish-next.yml +++ /dev/null @@ -1,52 +0,0 @@ -name: Publish next - -on: - workflow_dispatch: - push: - branches: - - main - -jobs: - publish: - concurrency: - group: publish-next - cancel-in-progress: true - - name: Publish @next release to npm - - runs-on: ubuntu-latest - - permissions: - id-token: write - - if: github.repository_owner == 'discordjs' && !(github.event_name == 'push' && startsWith(github.event.head_commit.message, 'chore(release)')) - - steps: - - name: Checkout repository - uses: actions/checkout@v5 - with: - fetch-depth: 0 - - - name: Use Node.js - uses: actions/setup-node@v5 - with: - cache: 'yarn' - node-version-file: package.json - - - name: Install Dependencies - run: yarn - - - name: Bump version - run: node ./scripts/bump-version.mjs - - - name: Deprecate old @next versions - run: yarn npm-deprecate --name "*next*" --package discord-api-types --message "No longer supported. Install the latest @next release" || true - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }} - - - name: Publish new @next version - run: | - yarn version $(jq --raw-output '.version' package.json)-next.$(git rev-parse --short HEAD).$(date +%s) - yarn npm publish --tag next - env: - YARN_NPM_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}