Publish dev #370
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish dev | |
on: | |
schedule: | |
- cron: '0 */12 * * *' | |
workflow_dispatch: | |
jobs: | |
npm-publish: | |
name: npm publish | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- package: '@discordjs/brokers' | |
folder: 'brokers' | |
- package: '@discordjs/builders' | |
folder: 'builders' | |
- package: '@discordjs/collection' | |
folder: 'collection' | |
- package: '@discordjs/core' | |
folder: 'core' | |
- package: '@discordjs/formatters' | |
folder: 'formatters' | |
- package: 'discord.js' | |
folder: 'discord.js' | |
- package: '@discordjs/next' | |
folder: 'next' | |
- package: '@discordjs/proxy' | |
folder: 'proxy' | |
- package: '@discordjs/rest' | |
folder: 'rest' | |
- package: '@discordjs/util' | |
folder: 'util' | |
- package: '@discordjs/voice' | |
folder: 'voice' | |
- package: '@discordjs/ws' | |
folder: 'ws' | |
runs-on: ubuntu-latest | |
env: | |
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} | |
TURBO_TEAM: ${{ secrets.TURBO_TEAM }} | |
if: github.repository_owner == 'discordjs' | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Install node.js v18 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
registry-url: https://registry.npmjs.org/ | |
- name: Check the current development version | |
id: pre-release | |
run: | | |
if [[ $(npm view ${{ matrix.package }}@dev version | grep -e "$(git rev-parse --short HEAD)") ]]; \ | |
then echo '::set-output name=release::false'; \ | |
else echo '::set-output name=release::true'; fi | |
- name: Install dependencies | |
if: steps.pre-release.outputs.release == 'true' | |
uses: ./packages/actions/src/pnpmCache | |
- name: Build dependencies | |
if: steps.pre-release.outputs.release == 'true' | |
run: pnpm run build | |
- name: Publish package | |
if: steps.pre-release.outputs.release == 'true' | |
run: | | |
pnpm --filter=${{ matrix.package }} run release --preid "dev.$(date +%s)-$(git rev-parse --short HEAD)" | |
pnpm --filter=${{ matrix.package }} publish --no-git-checks --tag dev || true | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }} | |
- name: Deprecate prior development releases | |
if: steps.pre-release.outputs.release == 'true' | |
run: pnpm exec npm-deprecate --name "*dev*" --message "This version is deprecated. Please use a newer version." --package ${{ matrix.package }} | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }} |