Files
discordeno/.github/workflows/release.yml
2024-11-19 16:43:17 -06:00

53 lines
1.7 KiB
YAML

name: Release
on:
push:
branches:
- main
paths:
- packages/**
- .github/**
release:
types: [published]
workflow_dispatch:
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write
strategy:
fail-fast: false
matrix:
package: ['gateway', 'rest', 'types', 'utils', 'bot', 'discordeno']
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18
registry-url: 'https://registry.npmjs.org'
scope: '@discordeno'
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
- uses: actions/cache@v4
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- run: yarn install --immutable
- name: build Package
run: yarn release-build --filter=./packages/${{ matrix.package }}
- name: Bump Package Version
if: ${{ github.event_name != 'release' && github.event.action != 'published' }}
run: node ./scripts/bumpVersionByCommit.js ${{ matrix.package }}
# If the action is running from a release use the latest tag, otherwise use the next tag
- run: npm publish --tag ${{ github.event_name == 'release' && github.event.action == 'published' && 'latest' || 'next' }} --access public --provenance
working-directory: packages/${{ matrix.package }}
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}