1- name : build and push
1+ ---
2+ name : Personal Build and Push
23on :
34 push :
45 branches :
6+ - " main"
57 - " feature/**"
6- - main
7- tags :
8- - " **"
8+ - " fix/**"
99 pull_request :
1010
11- env :
12- IMAGE_NAME : netbirdio/dashboard
13-
1411jobs :
1512 build_n_push :
1613 runs-on : ubuntu-latest
1714 steps :
1815 - uses : actions/checkout@v3
1916
2017 - name : setup-node
21- uses : actions/setup-node@v3
18+ uses : actions/setup-node@v4
2219 with :
23- node-version : ' 18 '
20+ node-version : ' lts/* '
2421 cache : ' npm'
2522
2623 - name : Install dependencies
@@ -39,23 +36,39 @@ jobs:
3936 -
4037 name : Docker meta
4138 id : meta
39+ if : github.event_name != 'pull_request'
4240 uses : docker/metadata-action@v4
4341 with :
44- images : ${{ env.IMAGE_NAME }}
42+ images : ghcr.io/ ${{ github.repository_owner }}/netbird-dashboard
4543 -
46- name : Login to DockerHub
44+ name : Login to GitHub Container Registry
4745 if : github.event_name != 'pull_request'
4846 uses : docker/login-action@v2
4947 with :
50- username : ${{ secrets.NB_DOCKER_USER }}
51- password : ${{ secrets.NB_DOCKER_TOKEN }}
48+ registry : ghcr.io
49+ username : ${{ github.repository_owner }}
50+ password : ${{ secrets.GITHUB_TOKEN }}
5251 -
5352 name : Docker build and push
53+ if : github.event_name != 'pull_request'
5454 uses : docker/build-push-action@v3
5555 with :
56+ cache-from : type=gha
57+ cache-to : type=gha,mode=max
5658 context : .
5759 file : docker/Dockerfile
5860 push : ${{ github.event_name != 'pull_request' }}
5961 platforms : linux/amd64,linux/arm64,linux/arm
6062 tags : ${{ steps.meta.outputs.tags }}
6163 labels : ${{ steps.meta.outputs.labels }}
64+ -
65+ name : Delete untagged GHCR images after push
66+ if : github.event_name != 'pull_request'
67+ uses : Chizkiyahu/delete-untagged-ghcr-action@v6
68+ continue-on-error : true
69+ with :
70+ token : ${{ secrets.PAT_GHCR_DELETE_IMAGES }}
71+ untagged_only : true
72+ except_untagged_multiplatform : true
73+ with_sigs : true
74+ owner_type : ' user'
0 commit comments