Skip to content

Commit

Permalink
feat(ci): npm publish, artifact caching & more (#3)
Browse files Browse the repository at this point in the history
* feat(ci): npm publish, artifact caching & more
  • Loading branch information
TotomInc authored Mar 12, 2024
1 parent 54aaf9e commit ceea710
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 12 deletions.
11 changes: 5 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
name: Build
name: Build & type-check

on:
push:
branches:
- main
- "*"
pull_request:
branches:
- main
- master

jobs:
build:
Expand All @@ -19,11 +19,10 @@ jobs:
- name: Setup Node.js environment
uses: actions/setup-node@v3
with:
node-version: 18
node-version: 18.x

- name: Install dependencies
run: npm ci --no-audit
run: npm i --no-audit

# Build script also run a type-check to ensure there are no type errors.
- name: Build
run: npm run build
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
#
# This action will use `changelogithub` which generates a changelog using
# conventional commits, inside the GitHub release.
#
# See: https://github.com/antfu/changelogithub

name: Release
name: Generate changelog

permissions:
contents: write
Expand All @@ -15,16 +17,20 @@ on:
- "v*"

jobs:
release:
changelog:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- uses: actions/setup-node@v3
- name: Setup Node.js environment
uses: actions/setup-node@v3
with:
node-version: 18.x
registry-url: "https://registry.npmjs.org"

- run: npx changelogithub
env:
Expand Down
32 changes: 32 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Publish package to npm

on:
push:
tags:
- "v*"

jobs:
publish:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Node.js environment
uses: actions/setup-node@v4
with:
node-version: 18.x
registry-url: "https://registry.npmjs.org"

- name: Install dependencies
run: npm i --no-audit

- name: Build
run: npm run build

- name: Publish to npm
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,7 +1,7 @@
{
"name": "vue3-select-component",
"type": "module",
"version": "0.1.3",
"version": "0.1.4-test.4",
"description": "A flexible & modern select-input control for Vue 3.",
"author": "Thomas Cazade <cazade.thomas@gmail.com>",
"license": "MIT",
Expand Down

0 comments on commit ceea710

Please sign in to comment.