mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
ci: better release workflow (#10325)
* ci: better release workflow * ci: simplify + use changelog * ci(release): better parsing and exclusions * ci(release): remove tree log * ci(release): improve logs * ci(release): properly check inputs * ci(release): better promise handling Co-authored-by: Aura <kyradiscord@gmail.com> * ci: refactor release to use bun * ci(release): whitespace Co-authored-by: Vlad Frangu <kingdgrizzle@gmail.com> * ci(release): add dev release handling * ci(release): fixes from testing * ci(release): make the promise run * ci(release): when specifying package, skip exclusions * ci(dev): create-discord-bot dev release * ci(release): improve changelog detection * ci: fix typo and allow releasing branches * ci(release): set make_latest for gh releases * ci(release): add ssh_key so pushed tags run workflow --------- Co-authored-by: Aura <kyradiscord@gmail.com> Co-authored-by: Vlad Frangu <kingdgrizzle@gmail.com> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
32
.github/workflows/publish-dev.yml
vendored
32
.github/workflows/publish-dev.yml
vendored
@@ -3,6 +3,10 @@ on:
|
||||
schedule:
|
||||
- cron: '0 */12 * * *'
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
dry_run:
|
||||
type: boolean
|
||||
default: false
|
||||
jobs:
|
||||
npm-publish:
|
||||
name: npm publish
|
||||
@@ -55,32 +59,18 @@ jobs:
|
||||
node-version: 22
|
||||
registry-url: https://registry.npmjs.org/
|
||||
|
||||
- name: Check the current development version
|
||||
id: release-check
|
||||
run: |
|
||||
if [[ $(npm view ${{ matrix.package }}@dev version | grep -e "$(git rev-parse --short HEAD)") ]]; \
|
||||
then echo "RELEASE=0" >> "$GITHUB_OUTPUT"; \
|
||||
else echo "RELEASE=1" >> "$GITHUB_OUTPUT"; \
|
||||
fi
|
||||
|
||||
- name: Install dependencies
|
||||
if: steps.release-check.outputs.release == '1'
|
||||
uses: ./packages/actions/src/pnpmCache
|
||||
|
||||
- name: Build dependencies
|
||||
if: steps.release-check.outputs.release == '1'
|
||||
run: pnpm run build
|
||||
|
||||
- name: Publish package
|
||||
if: steps.release-check.outputs.release == '1'
|
||||
run: |
|
||||
pnpm --filter=${{ matrix.package }} run release --preid "dev.$(date +%s)-$(git rev-parse --short HEAD)" --skip-changelog
|
||||
pnpm --filter=${{ matrix.package }} publish --provenance --no-git-checks --tag dev || true
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
|
||||
|
||||
- name: Deprecate prior development releases
|
||||
if: steps.release-check.outputs.release == '1'
|
||||
run: pnpm exec npm-deprecate --name "*dev*" --message "This version is deprecated. Please use a newer version." --package ${{ matrix.package }}
|
||||
- name: Publish packages
|
||||
uses: ./packages/actions/src/releasePackages
|
||||
with:
|
||||
exclude: '@discordjs/docgen'
|
||||
dry: ${{ inputs.dry_run }}
|
||||
dev: true
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
75
.github/workflows/release.yml
vendored
Normal file
75
.github/workflows/release.yml
vendored
Normal file
@@ -0,0 +1,75 @@
|
||||
name: Release
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
ref:
|
||||
description: 'The branch, tag or SHA to checkout'
|
||||
required: true
|
||||
default: 'main'
|
||||
package:
|
||||
description: 'The published name of a single package to release'
|
||||
type: choice
|
||||
required: false
|
||||
options:
|
||||
- all
|
||||
- discord.js
|
||||
- '@discordjs/brokers'
|
||||
- '@discordjs/builders'
|
||||
- '@discordjs/collection'
|
||||
- '@discordjs/core'
|
||||
- 'create-discord-bot'
|
||||
- '@discordjs/docgen'
|
||||
- '@discordjs/formatters'
|
||||
- '@discordjs/next'
|
||||
- '@discordjs/proxy'
|
||||
- '@discordjs/rest'
|
||||
- '@discordjs/util'
|
||||
- '@discordjs/voice'
|
||||
- '@discordjs/ws'
|
||||
exclude:
|
||||
description: 'Comma separated list of packages to exclude from release (if not depended upon)'
|
||||
required: false
|
||||
type: string
|
||||
default: '@discordjs/docgen,@discordjs/next'
|
||||
dry_run:
|
||||
type: boolean
|
||||
default: false
|
||||
jobs:
|
||||
npm-publish:
|
||||
name: npm publish
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
id-token: write
|
||||
contents: write
|
||||
env:
|
||||
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
|
||||
TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
|
||||
if: github.repository_owner == 'discordjs'
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ inputs.ref || '' }}
|
||||
ssh_key: ${{ secrets.DEPLOY_KEY_CI_RELEASE_TAGS }}
|
||||
|
||||
- name: Install Node.js v20
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20
|
||||
registry-url: https://registry.npmjs.org/
|
||||
|
||||
- name: Install dependencies
|
||||
uses: ./packages/actions/src/pnpmCache
|
||||
|
||||
- name: Build dependencies
|
||||
run: pnpm run build
|
||||
|
||||
- name: Release packages
|
||||
uses: ./packages/actions/src/releasePackages
|
||||
with:
|
||||
package: ${{ inputs.package }}
|
||||
exclude: ${{ inputs.exclude }}
|
||||
dry: ${{ inputs.dry_run }}
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
Reference in New Issue
Block a user