|
44 | 44 | REF_ID: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.ref || github.ref }} |
45 | 45 | run: echo "REF_ID=$REF_ID" >> $GITHUB_ENV |
46 | 46 |
|
47 | | - - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 |
48 | | - with: |
49 | | - persist-credentials: false |
50 | | - - name: Create version.json |
51 | | - run: | |
52 | | - # create a version.json per |
53 | | - # https://github.com/mozilla-services/Dockerflow/blob/master/docs/version_object.md |
54 | | - printf '{"commit":"%s","version":"%s","source":"%s","build":"%s"}\n' \ |
55 | | - "$GITHUB_SHA" \ |
56 | | - "$GITHUB_REF_NAME" \ |
57 | | - "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY" \ |
58 | | - "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" > version.json |
59 | | -
|
60 | 47 | - id: checkout_application_repo |
61 | 48 | name: checkout application repo |
62 | 49 | uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 |
@@ -113,6 +100,19 @@ jobs: |
113 | 100 | username: oauth2accesstoken |
114 | 101 | password: ${{ steps.gcp_auth.outputs.access_token }} |
115 | 102 |
|
| 103 | + - name: Create version.json |
| 104 | + run: | |
| 105 | + # create a version.json per |
| 106 | + # https://github.com/mozilla-services/Dockerflow/blob/master/docs/version_object.md |
| 107 | + # Must run AFTER the final checkout: actions/checkout defaults to |
| 108 | + # clean=true, which `git clean`s this untracked file. Creating it here, |
| 109 | + # right before the build, ensures it lands in the image via `COPY . .`. |
| 110 | + printf '{"commit":"%s","version":"%s","source":"%s","build":"%s"}\n' \ |
| 111 | + "$GITHUB_SHA" \ |
| 112 | + "$GITHUB_REF_NAME" \ |
| 113 | + "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY" \ |
| 114 | + "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID" > version.json |
| 115 | +
|
116 | 116 | - id: build_and_push |
117 | 117 | name: Build and push image |
118 | 118 | uses: docker/build-push-action@ca052bb54ab0790a636c9b5f226502c73d547a25 # v5 |
|
0 commit comments