File tree Expand file tree Collapse file tree 1 file changed +51
-0
lines changed
Expand file tree Collapse file tree 1 file changed +51
-0
lines changed Original file line number Diff line number Diff line change 1+ name : build-image
2+
3+ on :
4+ push :
5+ tags :
6+ - ' [0-9]+.[0-9]+.[0-9]+'
7+
8+ jobs :
9+ build-and-push :
10+ runs-on : ubuntu-latest
11+ steps :
12+ - name : Check out code
13+ uses : actions/checkout@v4
14+
15+ - name : Set up version variables
16+ id : vars
17+ run : |
18+ VERSION=${{ github.ref_name }}
19+ MAJOR=$(echo $VERSION | cut -d. -f1)
20+ MINOR=$(echo $VERSION | cut -d. -f2)
21+ REPO_NAME=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')
22+ echo "VERSION=$VERSION" >> $GITHUB_ENV
23+ echo "MAJOR=$MAJOR" >> $GITHUB_ENV
24+ echo "MINOR=$MINOR" >> $GITHUB_ENV
25+ echo "REPO_NAME=$REPO_NAME" >> $GITHUB_ENV
26+
27+ - name : Log in to GHCR
28+ uses : docker/login-action@v3
29+ with :
30+ registry : ghcr.io
31+ username : ${{ github.actor }}
32+ password : ${{ secrets.GITHUB_TOKEN }}
33+
34+ - name : Set up Docker Buildx
35+ uses : docker/setup-buildx-action@v3
36+
37+ - name : Build and push Docker image
38+ uses : docker/build-push-action@v6
39+ with :
40+ context : .
41+ file : Containerfile
42+ push : true
43+ sbom : true
44+ build-args : |
45+ GITLAB_SYNC_VERSION=${{ github.ref_name }}
46+ tags : |
47+ ghcr.io/${{ env.REPO_NAME }}:${{ github.ref_name }}
48+ ghcr.io/${{ env.REPO_NAME }}:${{ env.MAJOR }}.${{ env.MINOR }}
49+ ghcr.io/${{ env.REPO_NAME }}:${{ env.MAJOR }}
50+ ghcr.io/${{ env.REPO_NAME }}:latest
51+ platforms : linux/amd64,linux/arm64
You can’t perform that action at this time.
0 commit comments