Skip to content

Commit

Permalink
adjust astro build to gh-pages to run on release instead of push to m…
Browse files Browse the repository at this point in the history
…aster

add action for npm publish on creating release
  • Loading branch information
npup committed Apr 14, 2023
1 parent 593c85a commit 12418fc
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 3 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/astro.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@ name: Deploy Astro site to Pages

on:
# Runs on pushes targeting the default branch
push:
branches: ["master"]
# push:
# branches: ["master"]
# Runs on creating a release
release:
types: [published]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
Expand Down Expand Up @@ -56,7 +59,7 @@ jobs:
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: "18"
node-version: "18.x"
cache: ${{ steps.detect-package-manager.outputs.manager }}
cache-dependency-path: ${{ env.BUILD_PATH }}/package-lock.json
- name: Setup Pages
Expand Down
23 changes: 23 additions & 0 deletions .github/workflows/npm-publish-on-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: On creating a release, publish package to npm
on:
# Runs on creating a release
release:
types: [published]
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v3
# Setup .npmrc file to publish to GitHub Packages
- uses: actions/setup-node@v3
with:
node-version: "18.x"
registry-url: "https://registry.npmjs.org"
- run: npm ci
- run: npm run build
- run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 comments on commit 12418fc

Please sign in to comment.