File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11name : Go Demo -- Build and Push Container Image to GAR
22
33on :
4+ pull_request :
5+ types : [labeled, unlabeled, synchronize]
46 push :
57 branches :
68 - main
1618
1719jobs :
1820 build-and-push :
21+ if : >
22+ github.event_name == 'push' ||
23+ github.event_name == 'workflow_dispatch' ||
24+ (
25+ github.event_name == 'pull_request' &&
26+ contains(github.event.pull_request.labels.*.name, 'preview') &&
27+ github.event.pull_request.head.repo.full_name == github.repository
28+ )
1929 runs-on : ubuntu-latest
2030 permissions :
2131 contents : read
2535 - uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
2636 with :
2737 fetch-tags : true
38+ ref : ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.ref }}
2839 - uses : docker/setup-buildx-action@b5ca514318bd6ebac0fb2aedd5d36ec1b5c232a2
2940 - id : gcp-auth
3041 name : Google authentication
@@ -57,12 +68,14 @@ jobs:
5768 else
5869 tag="$(git rev-parse --short=10 HEAD)"
5970 fi
71+
6072 # append metadata if present
6173 if [[ -n "${{ env.METADATA }}" ]]; then
6274 tag="${tag}--${{ env.METADATA }}"
6375 fi
76+
6477 echo "Setting IMAGE_TAG=${tag} as output"
65- echo "IMAGE_TAG=${tag}" >> "$GITHUB_OUTPUT"
78+ echo "IMAGE_TAG=${tag}" >> "$GITHUB_OUTPUT"
6679 - name : Docker meta
6780 id : meta
6881 uses : docker/metadata-action@902fa8ec7d6ecbf8d84d538b9b233a880e428804
8396 push : true
8497 cache-from : type=gha
8598 cache-to : type=gha,mode=max
99+
Original file line number Diff line number Diff line change @@ -43,7 +43,7 @@ func main() {
4343 })
4444
4545 http .HandleFunc ("/" , func (w http.ResponseWriter , r * http.Request ) {
46- w .Write ([]byte ("Welcome to the cicd demo web app! Visit /__version__ for version information." ))
46+ w .Write ([]byte ("Welcome to the cicd demo go web app! Visit /__version__ for version information. Adding test string here " ))
4747 })
4848
4949 port := "8000"
You can’t perform that action at this time.
0 commit comments