forked from wei/pull
-
Notifications
You must be signed in to change notification settings - Fork 0
36 lines (36 loc) · 1.34 KB
/
publish.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
name: Build and Push
on:
push:
branches:
- master
jobs:
build:
name: Build and Push
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v1
with:
node-version: '16.x'
- run: npm ci
- run: npm test
- name: Login to GitHub Container Registry
run: |
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u $GITHUB_ACTOR --password-stdin
- name: Build Docker Image
run: |
docker pull ghcr.io/${{ github.repository }}:latest || :
docker build -t ghcr.io/${{ github.repository }}:latest . \
--cache-from ghcr.io/${{ github.repository }}:latest \
--build-arg VCS_REF=${{ github.sha }} \
--build-arg BUILD_DATE=$(date -u +'%Y-%m-%dT%H:%M:%SZ')
- name: Push Docker Image to GitHub Container Registry
run: |
docker push ghcr.io/${{ github.repository }}:latest
- name: Login to GitHub Package Registry
run: |
echo ${{ secrets.GITHUB_TOKEN }} | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin
- name: Push Docker Image to GitHub Package Registry
run: |
docker tag ghcr.io/${{ github.repository }}:latest docker.pkg.github.com/${{ github.repository }}/pull:latest
docker push docker.pkg.github.com/${{ github.repository }}/pull:latest