Publishing v1.4.6 #25
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 to NPM and GH Pages | |
run-name: Publishing ${{ github.event.inputs.releaseTag }} | |
on: | |
workflow_dispatch: | |
inputs: | |
releaseTag: | |
description: "Tag of version to be published to NPM and GH Pages" | |
required: true | |
jobs: | |
create-release: | |
name: "Create GH Release" | |
runs-on: ubuntu-latest | |
steps: | |
- name: Set env var | |
run: echo "RELEASE_TAG=$EVENT" >> $GITHUB_ENV | |
env: | |
EVENT: ${{ github.event.inputs.releaseTag }} | |
# Create GH Release | |
- name: Create Release | |
uses: "actions/github-script@v7" | |
with: | |
github-token: "${{ secrets.GITHUB_TOKEN }}" | |
script: | | |
try { | |
await github.rest.repos.createRelease({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
tag_name: process.env.RELEASE_TAG, | |
name: process.env.RELEASE_TAG, | |
draft: false, | |
prerelease: false, | |
generate_release_notes: true, | |
make_latest: "true" | |
}); | |
} catch (error) { | |
core.setFailed(error.message); | |
} | |
publish-npm: | |
name: "Publish to NPM" | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [20] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
registry-url: 'https://registry.npmjs.org' | |
scope: "@digitalspace" | |
- uses: actions/cache@v4 | |
with: | |
path: "**/node_modules" | |
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} | |
- name: Install dependencies | |
run: yarn install --silent --frozen-lockfile | |
- name: Cache Dist | |
uses: actions/cache@v4 | |
with: | |
path: "**/dist" | |
key: ${{ github.event.inputs.releaseTag }}-dist | |
- run: yarn publish --access public | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
publish-git: | |
name: "Publish to GitHub Packages" | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [20] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
registry-url: 'https://npm.pkg.github.com' | |
scope: "@digitalspace" | |
- uses: actions/cache@v4 | |
with: | |
path: "**/node_modules" | |
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} | |
- name: Install dependencies | |
run: yarn install --silent --frozen-lockfile | |
- name: Cache Dist | |
uses: actions/cache@v4 | |
with: | |
path: "**/dist" | |
key: ${{ github.event.inputs.releaseTag }}-dist | |
- run: yarn publish --access public | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
publish-pages: | |
runs-on: ubuntu-latest | |
permissions: | |
pages: write | |
id-token: write | |
strategy: | |
matrix: | |
node-version: [20] | |
environment: | |
name: github-pages | |
url: ${{steps.deployment.outputs.page_url}} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Cache Dist | |
uses: actions/cache@v4 | |
with: | |
path: "**/dist" | |
key: ${{ github.event.inputs.releaseTag }}-dist | |
- run: yarn pack --filename github-pages.tgz | |
- uses: actions/configure-pages@v4 | |
- uses: actions/upload-pages-artifact@v3 | |
with: | |
path: . | |
- id: deployment | |
uses: actions/deploy-pages@main |