Skip to content

Commit

Permalink
ci: add deployment pipelines (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
hpieterse authored Sep 5, 2024
1 parent eb658f9 commit c46cc1c
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 3 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/deploy-example.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Deploy example

on:
workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: "pages"
cancel-in-progress: false

jobs:
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Use Node.js 18.x
uses: actions/setup-node@v4
with:
node-version: 18.x
cache: 'npm'

- name: Install dependencies
working-directory: ./example
run: npm ci

- name: Build
working-directory: ./example
run: npm build

- name: Setup Pages
uses: actions/configure-pages@v5

- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
# Upload entire repository
path: './example/dist'

- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
29 changes: 29 additions & 0 deletions .github/workflows/deploy-npm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Deploy Node.js Package

on:
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18.x
- run: npm ci
- run: npm test

publish-npm:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 18.x
registry-url: https://registry.npmjs.org/
- run: npm ci
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "use-url-query-state",
"version": "1.0.3",
"version": "1.0.4",
"description": "Simple light weight React hook to use the url query parameters to store state",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down

0 comments on commit c46cc1c

Please sign in to comment.