-
Notifications
You must be signed in to change notification settings - Fork 0
85 lines (71 loc) · 2.41 KB
/
Copy pathrelease.yml
File metadata and controls
85 lines (71 loc) · 2.41 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
name: Release
# Push a version tag to publish, e.g.:
# npm version patch -w @cordfuse/barcoding-mcp # bump packages/mcp
# git commit -am "release v0.0.2" && git tag v0.0.2 && git push --follow-tags
on:
push:
tags: ["v*"]
jobs:
# ---- npm: @cordfuse/barcoding-mcp -------------------------------------
publish-npm:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
registry-url: https://registry.npmjs.org
cache: npm
- run: npm ci
- name: Guard — tag must match package version
run: |
TAG="${GITHUB_REF_NAME#v}"
PKG="$(node -p "require('./packages/mcp/package.json').version")"
if [ "$TAG" != "$PKG" ]; then
echo "::error::tag v$TAG != package version $PKG"; exit 1
fi
- run: npm run build -w @cordfuse/barcoding-mcp
- run: npm test -w @cordfuse/barcoding-mcp
- name: Assert token present
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
if [ -z "$NODE_AUTH_TOKEN" ]; then
echo "::error::NPM_TOKEN is empty in this job (secret not delivered)"; exit 1
fi
echo "token present, length ${#NODE_AUTH_TOKEN}"
- name: Publish to npm
run: npm publish -w @cordfuse/barcoding-mcp --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
# ---- GHCR: ghcr.io/cordfuse/barcoding-mcp ----------------------------
publish-ghcr:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- name: Resolve version
id: v
run: echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT"
- uses: docker/setup-buildx-action@v3
- name: Log in to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
file: docker/Dockerfile
push: true
tags: |
ghcr.io/${{ github.repository }}:${{ steps.v.outputs.version }}
ghcr.io/${{ github.repository }}:latest
cache-from: type=gha
cache-to: type=gha,mode=max