File tree Expand file tree Collapse file tree 1 file changed +33
-14
lines changed Expand file tree Collapse file tree 1 file changed +33
-14
lines changed Original file line number Diff line number Diff line change @@ -2,27 +2,46 @@ name: Release Danger-JS package
2
2
3
3
on :
4
4
push :
5
+ branches :
6
+ - ' master'
5
7
tags :
6
8
- ' *'
7
9
10
+ env :
11
+ REGISTRY : ghcr.io
12
+ IMAGE_NAME : ${{ github.repository }}
13
+
8
14
jobs :
9
15
build :
10
- runs-on : ubuntu-20.04
16
+ runs-on : ubuntu-latest
17
+ permissions :
18
+ contents : read
19
+ packages : write
11
20
12
21
steps :
13
- - uses : actions/checkout@v3
14
-
15
- - name : Export tag version
16
- run : echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
22
+ - name : Checkout
23
+ uses : actions/checkout@v3
17
24
18
- - name : Docker Login
19
- run : echo $PACKAGES_WRITE_TOKEN | docker login ghcr.io -u $USERNAME --password-stdin
20
- env :
21
- PACKAGES_WRITE_TOKEN : ${{ secrets.DOCKER_GITHUB_PASSWORD }}
22
- USERNAME : ${{ secrets.DOCKER_GITHUB_USERNAME }}
25
+ - name : Log in to the Container registry
26
+ uses : docker/login-action@v2
27
+ with :
28
+ registry : ${{ env.REGISTRY }}
29
+ username : ${{ github.actor }}
30
+ password : ${{ secrets.GITHUB_TOKEN }}
23
31
24
- - name : Docker Build
25
- run : docker build -t ghcr.io/danger/danger-js:$VERSION .
32
+ - name : Set up Docker metadata
33
+ id : meta
34
+ uses : docker/metadata-action@v4
35
+ with :
36
+ images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
37
+ tags : |
38
+ type=ref,event=branch
39
+ type=ref,event=tag
26
40
27
- - name : Deploy
28
- run : docker push ghcr.io/danger/danger-js:$VERSION
41
+ - name : Build and push Docker image
42
+ uses : docker/build-push-action@v4
43
+ with :
44
+ context : .
45
+ push : true
46
+ tags : ${{ steps.meta.outputs.tags }}
47
+ labels : ${{ steps.meta.outputs.labels }}
You can’t perform that action at this time.
0 commit comments