Jatin Mehra commited on
Commit
0594054
·
1 Parent(s): e755ec9

Add workflow script

Browse files
Files changed (1) hide show
  1. .github/workflows/deploy-image.yml +42 -0
.github/workflows/deploy-image.yml ADDED
@@ -0,0 +1,42 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: Create and publish a Docker image
2
+
3
+ on: push
4
+
5
+ env:
6
+ REGISTRY: ghcr.io
7
+ IMAGE_NAME: ${{ github.repository }}
8
+
9
+ jobs:
10
+ build-and-push-image:
11
+ runs-on: ubuntu-latest
12
+ permissions:
13
+ contents: read
14
+ packages: write
15
+
16
+ steps:
17
+ - name: Checkout repository
18
+ uses: actions/checkout@v3
19
+
20
+ - name: Log in to the Container registry
21
+ uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
22
+ with:
23
+ registry: ${{ env.REGISTRY }}
24
+ username: ${{ github.actor }}
25
+ password: ${{ secrets.GITHUB_TOKEN }}
26
+
27
+ - name: Extract metadata (tags, labels) for Docker
28
+ id: meta
29
+ uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
30
+ with:
31
+ images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
32
+ tags: |
33
+ type=ref,event=branch
34
+ type=sha
35
+
36
+ - name: Build and push Docker image
37
+ uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
38
+ with:
39
+ context: .
40
+ push: true
41
+ tags: ${{ steps.meta.outputs.tags }}
42
+ labels: ${{ steps.meta.outputs.labels }}