File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Create and Push Docker Image
2+
3+ on :
4+ workflow_dispatch :
5+
6+ push :
7+ tags :
8+ - " v[0-9]+\\ .[0-9]+\\ .[0-9]+"
9+ - " v[0-9]+\\ .[0-9]+\\ .[0-9]+-*"
10+
11+ env :
12+ GCP_GAR_REPOSITORY : ${{ vars.GCP_GAR_REPOSITORY }}
13+ GCP_REGION : ${{ vars.GCP_REGION }}
14+
15+ jobs :
16+ build-and-push-image :
17+ runs-on : ubuntu-latest
18+ permissions :
19+ contents : read
20+ packages : write
21+ id-token : write
22+ steps :
23+ - name : Check out code
24+ uses : actions/checkout@v5
25+
26+ - name : Authenticate to GCP
27+ uses : google-github-actions/auth@v2
28+ with :
29+ workload_identity_provider : ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }}
30+ service_account : ${{ secrets.GCP_SERVICE_ACCOUNT_EMAIL }}
31+
32+ - name : Set up Cloud SDK
33+ uses : google-github-actions/setup-gcloud@v2
34+
35+ - name : Configure Docker to use gcloud as a credential helper
36+ run : |
37+ gcloud auth configure-docker $GCP_REGION-docker.pkg.dev
38+
39+ - name : Extract tag name
40+ id : tag
41+ run : |
42+ if [[ $GITHUB_REF == refs/tags/* ]]; then
43+ echo "TAG_NAME=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
44+ else
45+ echo "TAG_NAME=latest" >> $GITHUB_OUTPUT
46+ fi
47+
48+ - name : Build Docker image
49+ run : |
50+ docker build -f Dockerfile -t ton-bridge:${{ steps.tag.outputs.TAG_NAME }} .
51+
52+ - name : Tag Docker image for GAR
53+ run : |
54+ docker tag ton-bridge:${{ steps.tag.outputs.TAG_NAME }} $GCP_GAR_REPOSITORY/ton-bridge:${{ steps.tag.outputs.TAG_NAME }}
55+
56+ - name : Push Docker image to GAR (with version tag)
57+ run : |
58+ docker push $GCP_GAR_REPOSITORY/ton-bridge:${{ steps.tag.outputs.TAG_NAME }}
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ COPY go.mod .
44COPY go.sum .
55RUN go mod download all
66COPY . .
7- RUN go build -o /tmp/bridge github.com/tonkeeper/bridge
7+ RUN go build -o /tmp/bridge ./
88
99
1010FROM scratch AS bridge
You can’t perform that action at this time.
0 commit comments