feat: publish-shared-types #6
Workflow file for this run
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: Theme Shared Types CI | |
on: | |
workflow_dispatch: | |
push: | |
paths: | |
- 'shared-types/index.ts' | |
jobs: | |
bump-version: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20.11.0 | |
- name: Configure git | |
run: | | |
git config --global user.name 'github-actions[bot]' | |
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
- name: Bump version | |
id: bump_version | |
run: | | |
cd shared-types && npm version patch -m "ci: bump shared types package version to %s" | |
- name: Push changes | |
run: | | |
git push | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
build: | |
runs-on: ubuntu-latest | |
if: contains(github.event.head_commit.message, '[publish-shared-types]') | |
steps: | |
- name: Set up Node 20 | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Enable corepack | |
run: | | |
corepack enable | |
- uses: actions/checkout@v4 | |
- name: Install dependencies | |
run: yarn install | |
- name: Build type declarations file | |
run: cd shared-types && yarn build | |
- name: Upload types artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: types-artifacts | |
path: shared-types/dist/types.d.ts | |
publish-npm: | |
needs: build | |
runs-on: ubuntu-latest | |
if: contains(github.event.head_commit.message, '[publish-shared-types]') | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
registry-url: https://registry.npmjs.org/ | |
- name: Download build artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: types-artifacts | |
path: shared-types/dist | |
- run: cd shared-types && npm publish --access public | |
env: | |
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} |