Skip to content

Commit

Permalink
@comet/create-app: Automatic publishing (#66)
Browse files Browse the repository at this point in the history
Publishes a minor release when merging a pull request with changes in
`create-app/` into `main`.
  • Loading branch information
johnnyomair authored Jan 30, 2024
1 parent c18d691 commit d31e5c3
Showing 1 changed file with 56 additions and 0 deletions.
56 changes: 56 additions & 0 deletions .github/workflows/publish-create-app.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Publish @comet/create-app

on:
pull_request:
types:
- closed
branches:
- main
paths:
- create-app/**

jobs:
publish:
name: Publish @comet/create-app
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- run: echo "${{ github.actor }}"

- uses: actions/checkout@v3
with:
token: ${{ secrets.VIVID_PLANET_BOT_TOKEN }}
- run: |
git config user.name github-actions
git config user.email github-actions@github.com
- name: Use Node.js 18.x
uses: actions/setup-node@v3
with:
node-version: 18
cache: "npm"
cache-dependency-path: "create-app/package-lock.json"
registry-url: "https://registry.npmjs.org"

- name: Install dependencies
run: npm ci
working-directory: create-app/

- name: Build
run: npm run build
working-directory: create-app/

- name: Bump version
run: echo "NEW_VERSION=$(npm --no-git-tag-version version minor)" >> $GITHUB_ENV
working-directory: create-app/

- name: Commit package.json
uses: EndBug/add-and-commit@v9
with:
message: "@comet/create-app: Publish ${{ env.NEW_VERSION }}"

- name: Publish release
run: npm publish
working-directory: create-app/
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 comments on commit d31e5c3

Please sign in to comment.