ci: create publish release workflow (#9150)

* ci: create publish release workflow

* test: fix tests for formatTag

* ci(publish-release): fix string concat

* ci: release action runs with tag as source

* ci(publish-release): no longer testing

---------

Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
ckohen
2023-02-21 12:15:39 -08:00
committed by GitHub
parent fd0246ca4c
commit 6e481f0a30
4 changed files with 56 additions and 7 deletions

39
.github/workflows/publish-release.yml vendored Normal file
View File

@@ -0,0 +1,39 @@
name: Publish Release
on:
release:
types: [released]
jobs:
npm-publish:
name: npm publish
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
- name: Install node.js v16
uses: actions/setup-node@v3
with:
node-version: 16
registry-url: https://registry.npmjs.org/
- name: Install dependencies
uses: ./packages/actions/src/yarnCache
- name: Build dependencies
run: yarn build
- name: Extract package and semver from tag
id: extract-tag
uses: ./packages/actions/src/formatTag
with:
tag: ${{ github.ref_name }}
- name: Publish package
run: |
yarn workspace ${{ steps.extract-tag.outputs.subpackage == 'true' && '@discordjs/' || '' }}${{ steps.extract-tag.outputs.package }} npm publish
env:
YARN_NPM_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}