Repository navigation
60 lines (50 loc) · 1.64 KB
/
Copy pathrelease.yml
File metadata and controls
60 lines (50 loc) · 1.64 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
name: Publish to npm.js
on:
release:
types: [published]
jobs:
publish:
runs-on: ubuntu-22.04
permissions:
contents: read
id-token: write
steps:
- name: Clone repo
uses: actions/checkout@v4
- name: Set .nvmrc content to stage output
id: nvmrc
run: |
echo "node_version=$(cat .nvmrc | sed 's/v//g')" >> $GITHUB_OUTPUT
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ steps.nvmrc.outputs.node_version }}
registry-url: 'https://registry.npmjs.org'
- name: Install dependencies
run: npm ci
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
with:
platforms: linux/amd64,linux/arm64
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
-
name: Build and push
uses: docker/build-push-action@v6
with:
push: true
tags: ${{ github.repository }}:latest,${{ github.repository }}:${{ github.event.release.tag_name }}
context: .
file: Dockerfile
platforms: linux/amd64,linux/arm64
# publish to npm after docker image is built and pushed.
# this to avoid publishing to npm registry before a possible docker image build failure
- name: Publish to npm
run: npm publish --provenance --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}