1212# See the License for the specific language governing permissions and
1313# limitations under the License.
1414
15- name : Docker
15+ name : Cloud Builder Docker
1616
1717# This workflow uses actions that are not certified by GitHub.
1818# They are provided by a third-party and are governed by
@@ -22,15 +22,13 @@ name: Docker
2222on :
2323 push :
2424 # Publish semver tags as releases.
25- tags :
26- - v1 .[0-9]+
27- - v1 .[0-9]+.[0-9]+-beta
25+ tags :
26+ - v[0-1] .[0-9]+
27+ - v[0-1] .[0-9]+.[0-9]+-beta
2828
2929env :
30- # Use docker.io for Docker Hub if empty
3130 REGISTRY : ghcr.io
32- # github.repository as <account>/<repo>
33- IMAGE_NAME : ${{ github.repository }}
31+ IMAGE_NAME : apigee/apigeecli
3432
3533
3634jobs :
5250 # https://github.com/sigstore/cosign-installer
5351 - name : Install cosign
5452 if : github.event_name != 'pull_request'
55- uses : sigstore/cosign-installer@main
56- with :
57- cosign-release : " v1.13.1"
53+ uses : sigstore/cosign-installer@v3.1.1
54+
5855
5956 # Workaround: https://github.com/docker/build-push-action/issues/461
6057 - name : Setup Docker buildx
@@ -82,22 +79,20 @@ jobs:
8279 # https://github.com/docker/build-push-action
8380 - name : Build and push Docker image
8481 id : build-and-push
85- uses : docker/build-push-action@ac9327eae2b366085ac7f6a2d02df8aa8ead720a
82+ uses : docker/build-push-action@v4.0.0
8683 with :
8784 context : .
85+ file : Dockerfile.builder
8886 push : ${{ github.event_name != 'pull_request' }}
8987 tags : ${{ steps.meta.outputs.tags }}
9088 labels : ${{ steps.meta.outputs.labels }}
9189
92- # Sign the resulting Docker image digest except on PRs.
93- # This will only write to the public Rekor transparency log when the Docker
94- # repository is public to avoid leaking data. If you would like to publish
95- # transparency data even for private images, pass --force to cosign below.
96- # https://github.com/sigstore/cosign
97- - name : Sign the published Docker image
98- if : ${{ github.event_name != 'pull_request' }}
90+ # https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable
91+ - name : Sign image with a key
92+ run : |
93+ cosign sign --yes --key env://COSIGN_PRIVATE_KEY "${TAGS}@${DIGEST}"
9994 env :
100- COSIGN_EXPERIMENTAL : " true "
101- # This step uses the identity token to provision an ephemeral certificate
102- # against the sigstore community Fulcio instance.
103- run : echo "${{ steps.meta.outputs.tags }}" | xargs -I {} cosign sign {}@ ${{ steps.build-and-push.outputs.digest }}
95+ TAGS : ${{ steps.docker_meta.outputs.tags }}
96+ COSIGN_PRIVATE_KEY : ${{ secrets.COSIGN_PRIVATE_KEY }}
97+ COSIGN_PASSWORD : ${{ secrets.COSIGN_PASSWORD }}
98+ DIGEST : ${{ steps.build-and-push.outputs.digest }}
0 commit comments