1
+ name : Deploy Images to GHCR
2
+
3
+ on :
4
+ push :
5
+ branches :
6
+ - main # Trigger only on push to main branch
7
+ tags : # Trigger on new tags
8
+ - ' v*' # You can adjust this pattern to match your tag naming convention
9
+
10
+ jobs :
11
+ push-store-image :
12
+ runs-on : ubuntu-latest
13
+ permissions :
14
+ contents : read
15
+ packages : write
16
+ steps :
17
+ - name : ' Checkout GitHub Action'
18
+ uses : actions/checkout@main
19
+
20
+ - name : ' Set up Docker Buildx'
21
+ uses : docker/setup-buildx-action@v1
22
+
23
+ - name : ' Login to GitHub Container Registry'
24
+ uses : docker/login-action@v1
25
+ with :
26
+ registry : ghcr.io
27
+ username : ${{ github.actor }}
28
+ password : ${{ secrets.GITHUB_TOKEN }}
29
+
30
+ - name : ' Extract short hash'
31
+ id : vars
32
+ run : echo "SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV # This sets the SHORT_SHA environment variable
33
+
34
+ - name : ' Set Docker tag'
35
+ id : docker_tag
36
+ run : |
37
+ if [[ "${{ github.ref }}" == refs/tags/* ]]; then
38
+ TAG_NAME=${{ github.ref }}
39
+ TAG_NAME=${TAG_NAME##*/}
40
+ echo "DOCKER_TAG=${TAG_NAME}" >> $GITHUB_ENV
41
+ else
42
+ echo "DOCKER_TAG=${{ env.SHORT_SHA }}" >> $GITHUB_ENV
43
+ fi
44
+
45
+ - name : ' Build pbs image'
46
+ run : |
47
+ docker build --tag ghcr.io/commit-boost/commit-boost-client/pbs:${{ env.DOCKER_TAG }} -f docker/pbs.Dockerfile .
48
+ docker push ghcr.io/commit-boost/commit-boost-client/pbs:${{ env.DOCKER_TAG }}
49
+
50
+ - name : ' Build signer image'
51
+ run : |
52
+ docker build --tag ghcr.io/commit-boost/commit-boost-client/signer:${{ env.DOCKER_TAG }} -f docker/signer.Dockerfile .
53
+ docker push ghcr.io/commit-boost/commit-boost-client/signer:${{ env.DOCKER_TAG }}
0 commit comments