Skip to content

Commit 766487e

Browse files
committed
GitHub action added
1 parent dd9bf42 commit 766487e

1 file changed

Lines changed: 41 additions & 0 deletions

File tree

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Build and Push Docker Image
2+
3+
on:
4+
push:
5+
branches: [ "reproducible" ]
6+
pull_request:
7+
branches: [ "reproducible" ]
8+
9+
env:
10+
REGISTRY: ghcr.io
11+
IMAGE_NAME: ${{ github.repository }}
12+
13+
jobs:
14+
build-and-push:
15+
runs-on: ubuntu-latest
16+
permissions:
17+
contents: read
18+
packages: write
19+
20+
steps:
21+
- name: Checkout code
22+
uses: actions/checkout@v4
23+
24+
- name: Set up Docker Buildx
25+
uses: docker/setup-buildx-action@v3
26+
27+
- name: Log in to the Container registry
28+
uses: docker/login-action@v3
29+
with:
30+
registry: ${{ env.REGISTRY }}
31+
username: ${{ github.actor }}
32+
password: ${{ secrets.GITHUB_TOKEN }}
33+
34+
- name: Build and push
35+
uses: docker/build-push-action@v5
36+
with:
37+
context: .
38+
push: ${{ github.event_name != 'pull_request' }}
39+
tags: |
40+
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
41+
${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.sha }}

0 commit comments

Comments
 (0)