create runner script for CLI #7
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: adog-hydra-lib-publish | |
on: [push] | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
env: | |
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTOMATION_TOKEN }} | |
GITHUB_TOKEN: ${{ secrets.GH_AUTOMATION_TOKEN }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: pnpm/action-setup@v2 | |
with: | |
version: 8 | |
run_install: | | |
- recursive: true | |
args: [--frozen-lockfile, --strict-peer-dependencies] | |
- args: [--global, gulp, prettier, typescript] | |
- uses: actions/cache@v3 | |
with: | |
path: '**/node_modules' | |
key: ${{ runner.os }}-modules-${{ hashFiles('**/pnpm-lock.yaml') }} | |
- name: Configure NPM token | |
run: echo "//registry.npmjs.org/:_authToken=${NPM_AUTH_TOKEN}" > ~/.npmrc | |
- run: pnpm install | |
# Conditional step based on branch name | |
- name: Create Release Pull Request | |
id: changesets-version | |
uses: changesets/action@v1 | |
with: | |
version: | | |
pnpm generate-pr | |
env: | |
GITHUB_TOKEN: ${{ secrets.GH_AUTOMATION_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_AUTOMATION_TOKEN }} | |
if: github.ref != 'refs/heads/main' | |
- name: Publish packages | |
id: changesets-publish | |
uses: changesets/action@v1 | |
with: | |
publish: | | |
pnpm publish-packages | |
env: | |
GITHUB_TOKEN: ${{ secrets.GH_AUTOMATION_TOKEN }} | |
NPM_TOKEN: ${{ secrets.NPM_AUTOMATION_TOKEN }} | |
if: github.ref == 'refs/heads/main' |