1- name : Release
1+ name : Docker
2+
3+ # This workflow uses actions that are not certified by GitHub.
4+ # They are provided by a third-party and are governed by
5+ # separate terms of service, privacy policy, and support
6+ # documentation.
27
38on :
9+ schedule :
10+ - cron : ' 41 6 * * *'
411 push :
512 branches :
613 - master
714
815env :
9- DOCKER_IMAGE_NAME : mergeability/mergeable
16+ # Use docker.io for Docker Hub if empty
17+ REGISTRY : ghcr.io
18+ # github.repository as <account>/<repo>
19+ IMAGE_NAME : ${{ github.repository }}
20+
1021
1122jobs :
1223 build :
13- name : Release
24+
1425 runs-on : ubuntu-latest
26+ permissions :
27+ contents : read
28+ packages : write
29+ # This is used to complete the identity challenge
30+ # with sigstore/fulcio when running outside of PRs.
31+ id-token : write
32+
1533 steps :
16- - name : Checkout
34+ - name : Checkout repository
1735 uses : actions/checkout@v4
36+
37+ # Install the cosign tool except on PR
38+ # https://github.com/sigstore/cosign-installer
39+ - name : Install cosign
40+ if : github.event_name != 'pull_request'
41+ uses : sigstore/cosign-installer@4959ce089c160fddf62f7b42464195ba1a56d382 # v3.6.0
42+ with :
43+ cosign-release : ' v2.2.4'
44+
45+ # Get release version information from github commits
1846 - name : Semantic Release
1947 id : semantic
2048 uses : cycjimmy/semantic-release-action@v4
2149 env :
2250 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
23- NPM_TOKEN : ${{ secrets.NPM_TOKEN }}
24- - name : Login to Docker Hub
25- uses : docker/login-action@v3
51+
52+ # Set up BuildKit Docker container builder to be able to build
53+ # multi-platform images and export cache
54+ # https://github.com/docker/setup-buildx-action
55+ - name : Set up Docker Buildx
56+ uses : docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # v3.6.1
57+
58+ # Login against a Docker registry except on PR
59+ # https://github.com/docker/login-action
60+ - name : Log into registry ${{ env.REGISTRY }}
61+ if : github.event_name != 'pull_request'
62+ uses : docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
2663 with :
27- username : ${{ secrets.DOCKERHUB_USERNAME }}
28- password : ${{ secrets.DOCKERHUB_TOKEN }}
29- if : ${{ steps.semantic.outputs.new_release_version }}
30- -
uses :
buildpacks/github-actions/[email protected] 31- if : ${{ steps.semantic.outputs.new_release_version }}
32- - name : Build and publish docker image
64+ registry : ${{ env.REGISTRY }}
65+ username : ${{ github.actor }}
66+ password : ${{ secrets.GITHUB_TOKEN }}
67+
68+ # Extract metadata (tags, labels) for Docker
69+ # https://github.com/docker/metadata-action
70+ - name : Extract Docker metadata
71+ id : meta
72+ uses : docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5.5.1
73+ with :
74+ images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
75+
76+ # Build and push Docker image with Buildx (don't push on PR)
77+ # https://github.com/docker/build-push-action
78+ - name : Build and push Docker image
3379 if : ${{ steps.semantic.outputs.new_release_version }}
34- run : pack build ${{ env.DOCKER_IMAGE_NAME }} -t ${{ env.DOCKER_IMAGE_NAME }}:${{ steps.semantic.outputs.new_release_version }} -t ${{ env.DOCKER_IMAGE_NAME }}:latest -B paketobuildpacks/builder-jammy-tiny -b docker.io/paketobuildpacks/nodejs --publish
80+ id : build-and-push
81+ uses : docker/build-push-action@5cd11c3a4ced054e52742c5fd54dca954e0edd85 # v6.7.0
82+ with :
83+ context : .
84+ push : ${{ github.event_name != 'pull_request' }}
85+ tags : ${{ steps.semantic.outputs.new_release_version }}
86+ labels : ${{ steps.meta.outputs.labels }}
87+ cache-from : type=gha
88+ cache-to : type=gha,mode=max
89+
90+ # Sign the resulting Docker image digest except on PRs.
91+ # This will only write to the public Rekor transparency log when the Docker
92+ # repository is public to avoid leaking data. If you would like to publish
93+ # transparency data even for private images, pass --force to cosign below.
94+ # https://github.com/sigstore/cosign
95+ - name : Sign the published Docker image
96+ if : ${{ github.event_name != 'pull_request' }}
97+ env :
98+ # https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable
99+ TAGS : ${{ steps.meta.outputs.tags }}
100+ DIGEST : ${{ steps.build-and-push.outputs.digest }}
101+ # This step uses the identity token to provision an ephemeral certificate
102+ # against the sigstore community Fulcio instance.
103+ run : echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST}
0 commit comments