-
Notifications
You must be signed in to change notification settings - Fork 2
109 lines (109 loc) · 3.19 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
name: 🤹♂️ Continuous Integration
on:
push:
branches: [main]
pull_request:
branches: [main]
workflow_dispatch:
jobs:
test:
name: 🧪 Test
runs-on: ubuntu-latest
steps:
- name: ☂️ Code Coverage
uses: codecov/codecov-action@v3
with:
token: ${{ secrets.CODECOV_TOKEN }}
lint:
name: ⚖️ Lint
runs-on: ubuntu-latest
steps:
- name: 🛫 Checkout Code
uses: actions/checkout@v4
- name: 📦 Setup Node
uses: actions/setup-node@v4
with:
node-version: 21
registry-url: https://registry.npmjs.org/
scope: '@pungrumpy'
- name: 🚀 Setup Bun
uses: oven-sh/setup-bun@v1
- name: 🔽 Install Dependencies
run: bun install
- name: ⚖️ Lint
run: bun lint
version:
name: 📝 Validate Version
runs-on: ubuntu-latest
needs: lint
steps:
- name: 🛫 Checkout Code
uses: actions/checkout@v4
- name: 📦 Setup Node
uses: actions/setup-node@v4
with:
node-version: 21
registry-url: https://registry.npmjs.org/
scope: '@pungrumpy'
- name: 🚀 Setup Bun
uses: oven-sh/setup-bun@v1
- name: 🔽 Install Dependencies
run: bun install
- name: 🧑🍳 Check version exists
run: |
VERSION=$(node -p "require('./package.json').version")
VERSION_ON_NPM=$(npm show logixlysia version 2>/dev/null || echo "false")
if [ "$VERSION" = "$VERSION_ON_NPM" ]; then
touch .version
echo "✅ Version $VERSION exists on npm"
echo "✅ Version $VERSION exists on npm" > .version
else
touch .version
echo "❌ Version $VERSION does not exist on npm"
echo "❌ Version $VERSION does not exist on npm" > .version
fi
shell: bash
- name: 😶🌫️ Upload artifacts
uses: actions/upload-artifact@v3
if: failure()
with:
name: logs
path: |
.version
build:
name: 🍞 Deploy
runs-on: ubuntu-latest
needs: [test, lint, version]
steps:
- name: 🛫 Checkout Code
uses: actions/checkout@v4
- name: 📦 Setup Node
uses: actions/setup-node@v4
with:
node-version: 21
registry-url: https://registry.npmjs.org/
scope: '@pungrumpy'
- name: 🚀 Setup Bun
uses: oven-sh/setup-bun@v1
- name: 🔽 Install Dependencies
run: bun install
- name: 🛰️ Publish
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
report:
name: 📊 Report
needs: [test, lint, version, build]
runs-on: ubuntu-latest
if: failure()
steps:
- name: 👧 Information output
run: |
echo "⚠️ Something went wrong"
echo "📦 Package: ${{ github.repository }}"
echo "📝 Commit: ${{ github.sha }}"
echo "🌐 Workflow: ${{ github.workflow }}"
echo "📅 Date: $(date)"
echo "🧑💻 Author: ${{ github.actor }}"
echo "📄 Ref: ${{ github.ref }}"
shell: bash