Skip to content

Commit 3f25dd8

Browse files
committed
chore(ci): Setup CI/CD via Github Actions
1 parent 0a62ece commit 3f25dd8

7 files changed

Lines changed: 129 additions & 1 deletion

File tree

.github/workflows/ci.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [master]
6+
pull_request:
7+
branches: [master]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
- uses: actions/setup-node@v4
15+
with:
16+
node-version: 20
17+
cache: npm
18+
- run: npm ci
19+
- run: npm test
20+
- run: npm run build

.github/workflows/publish.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Publish
2+
3+
on:
4+
push:
5+
tags: ['v*']
6+
7+
permissions:
8+
id-token: write
9+
contents: write
10+
packages: write
11+
12+
jobs:
13+
publish:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
18+
- uses: actions/setup-node@v4
19+
with:
20+
node-version: 24
21+
cache: npm
22+
23+
- run: npm ci
24+
- run: npm test
25+
- run: npm run build
26+
27+
- name: Publish to npm
28+
run: npm publish --provenance --access public
29+
30+
- name: Pack tarball
31+
run: npm pack
32+
33+
- name: Create GitHub Release
34+
uses: softprops/action-gh-release@v2
35+
with:
36+
generate_release_notes: true
37+
files: '*.tgz'
38+
39+
- name: Publish to GitHub Packages
40+
run: |
41+
echo "//npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN}" > ~/.npmrc
42+
echo "@josephharveyangeles:registry=https://npm.pkg.github.com" >> ~/.npmrc
43+
sed -i 's/"name": "vue-animate-onscroll"/"name": "@josephharveyangeles\/vue-animate-onscroll"/' package.json
44+
npm publish --access public
45+
env:
46+
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/release.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'Version number (e.g. 3.0.0)'
8+
required: true
9+
type: string
10+
11+
permissions:
12+
contents: write
13+
14+
jobs:
15+
release:
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v4
19+
20+
- uses: actions/setup-node@v4
21+
with:
22+
node-version: 20
23+
cache: npm
24+
25+
- name: Configure git
26+
run: |
27+
git config user.name "github-actions[bot]"
28+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
29+
30+
- name: Bump version
31+
run: npm version "${{ inputs.version }}" --no-git-tag-version
32+
33+
- run: npm ci
34+
- run: npm test
35+
36+
- name: Commit, tag, and push
37+
run: |
38+
git add package.json package-lock.json
39+
git commit -m "chore(release): v${{ inputs.version }}"
40+
git tag "v${{ inputs.version }}"
41+
git push && git push --tags

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
# vue-animate-onscroll
2+
3+
[![Publish](https://github.com/josephharveyangeles/vue-animate-onscroll/actions/workflows/publish.yml/badge.svg)](https://github.com/josephharveyangeles/vue-animate-onscroll/actions/workflows/publish.yml)
4+
[![Netlify Status](https://api.netlify.com/api/v1/badges/53a7ee61-bc19-43cf-9544-02cac57ff3fd/deploy-status)](https://app.netlify.com/projects/vue-animate-onscroll/deploys)
5+
26
A simple Vue 3 directive that animates elements as they scroll into view.
37

48
## Installation

mise.toml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,18 @@
11
[tools]
22
node = "22"
3+
4+
[tasks.publish]
5+
description = "Bump version, test, commit, tag, and push to trigger publish"
6+
run = """
7+
#!/usr/bin/env bash
8+
set -euo pipefail
9+
VERSION="${1:?Usage: mise run publish <version>}"
10+
npm version "$VERSION" --no-git-tag-version
11+
npm ci
12+
npm test
13+
git add package.json package-lock.json
14+
git commit -m "chore(release): v$VERSION"
15+
git tag "v$VERSION"
16+
git push && git push --tags
17+
echo "Released v$VERSION — publish workflow will run on GitHub"
18+
"""

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"author": "yev",
2424
"repository": {
2525
"type": "git",
26-
"url": "https://github.com/josephharveyangeles/vue-animate-onscroll"
26+
"url": "https://github.com/yvhr/vue-animate-onscroll"
2727
},
2828
"keywords": [
2929
"vue",

vite.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export default defineConfig({
1313
rollupOptions: {
1414
external: ['vue'],
1515
output: {
16+
exports: 'named',
1617
globals: {
1718
vue: 'Vue',
1819
},

0 commit comments

Comments
 (0)