diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 000000000..e9fb8ef80 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,70 @@ +name: Publish Release + +on: + workflow_dispatch: + push: + tags: + - 'v[0-9]+.[0-9]+.[0-9]+' # Release versions + - '[0-9]+.[0-9]+.[0-9]+' + - 'v[0-9]+.[0-9]+.[0-9]+-beta.[0-9]+' # Beta versions + - '[0-9]+.[0-9]+.[0-9]+-beta.[0-9]+' + +permissions: + contents: read + packages: write + +jobs: + publish-npm: + name: 'NPM' + runs-on: ubuntu-latest + environment: release + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version: ${{ env.NODE_VERSION }} + cache: 'npm' + + - name: Build package + uses: ./.github/actions/build + with: + node: ${{ env.NODE_VERSION }} + + - name: Publish release to NPM + run: npm publish + env: + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + + - name: Publish release to CDN + run: ccu --trace + + publish-gh: + needs: publish-npm # Don't publish to GitHub Packages until NPM is done + + name: 'GitHub Packages' + runs-on: ubuntu-latest + environment: release + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version: ${{ env.NODE_VERSION }} + cache: 'npm' + + - name: Build package + uses: ./.github/actions/build + with: + node: ${{ env.NODE_VERSION }} + + - name: Publish release to GitHub Packages + run: npm publish + env: + NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}