-
Notifications
You must be signed in to change notification settings - Fork 1
103 lines (86 loc) · 2.86 KB
/
release.yml
File metadata and controls
103 lines (86 loc) · 2.86 KB
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
name: Release
on:
push:
tags:
- "v*"
jobs:
# ─── Step 1: Validate before publishing anything ────────────────────────────
test:
name: Syntax & dependency check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm
- name: Install dependencies
run: npm ci
- name: Syntax check
run: |
node --check server/server.js
node --check server/config.js
node --check server/db.js
node --check server/cleanup.js
node --check bin/instbyte.js
# ─── Step 2a: Publish to npm ─────────────────────────────────────────────────
publish-npm:
name: Publish to npm
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Node.js with npm registry
uses: actions/setup-node@v4
with:
node-version: 20
registry-url: "https://registry.npmjs.org"
cache: npm
- name: Install production dependencies
run: npm ci --omit=dev
- name: Publish
run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
# ─── Step 2b: Build and push Docker image (multi-platform) ──────────────────
publish-docker:
name: Publish to Docker Hub
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up QEMU (for ARM emulation)
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Extract version tag
id: meta
run: echo "tag=${GITHUB_REF_NAME}" >> $GITHUB_OUTPUT
- name: Build and push
uses: docker/build-push-action@v5
with:
context: .
platforms: linux/amd64
push: true
tags: |
mohitgauniyal/instbyte:latest
mohitgauniyal/instbyte:${{ steps.meta.outputs.tag }}
# ─── Step 3: Create GitHub Release with auto-generated notes ────────────────
create-release:
name: Create GitHub Release
needs: [publish-npm, publish-docker]
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Create release
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true