Skip to content

Commit f46b17d

Browse files
committed
Create npm-publish.yml
1 parent bc20e1e commit f46b17d

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

.github/workflows/npm-publish.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
2+
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
3+
4+
name: Node.js Package
5+
env:
6+
REGISTRY: ghcr.io
7+
IMAGE_NAME: ${{github.repository}}
8+
GIT_TOKEN: ${{secrets.GIT_TOKEN}}
9+
on:
10+
push:
11+
branches: ["main"]
12+
pull_request:
13+
branches: "*"
14+
jobs:
15+
## docker publication normal
16+
publish-docker-normal:
17+
runs-on: ubuntu-latest
18+
env:
19+
GIT_TOKEN: ${{secrets.GIT_TOKEN}}
20+
permissions:
21+
contents: read
22+
packages: write
23+
if: ${{github.ref == 'refs/heads/main'}}
24+
steps:
25+
- name: Checkout repository
26+
uses: actions/checkout@v3
27+
- name: Log in to the Container registry
28+
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
29+
with:
30+
registry: ${{ env.REGISTRY }}
31+
username: ${{ github.actor }}
32+
password: ${{ secrets.GIT_TOKEN }}
33+
- name: Extract metadata (tags, labels) for Docker
34+
id: meta
35+
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
36+
with:
37+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
38+
tags: |
39+
type=ref,event=branch
40+
type=sha
41+
- run: ls -a -R .
42+
- name: Build and push Docker image
43+
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
44+
with:
45+
context: .
46+
push: true
47+
tags: ${{ steps.meta.outputs.tags }}
48+
labels: ${{ steps.meta.outputs.labels }}

0 commit comments

Comments
 (0)