@@ -72,78 +72,78 @@ jobs:
7272 BRANCH : gh-pages # The branch the action should deploy to.
7373 FOLDER : docs # The folder the action should deploy
7474
75- # docker-build-and-push:
76- # #needs: r-build-and-check
77- # runs-on: ubuntu-latest
78- # permissions:
79- # contents: read
80- # packages: write
81- # # This is used to complete the identity challenge
82- # # with sigstore/fulcio when running outside of PRs.
83- # id-token: write
84- # steps:
85- # - name: Checkout repository
86- # uses: actions/checkout@v2
87- #
88- # - name: Set Environment Variables
89- # run: |
90- # REPO_LOWER="$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]')"
91- # REGISTRY=ghcr.io
92- # echo "BUILD_DATE=$(date +'%Y-%m-%d %H:%M:%S')" >> $GITHUB_ENV
93- # echo "GIT_SHA=$(echo ${{ github.sha }} | cut -c1-7)" >> $GITHUB_ENV
94- # echo "REGISTRY=${REGISTRY}" >> $GITHUB_ENV
95- # echo "IMAGE=${REGISTRY}/${REPO_LOWER}" >> $GITHUB_ENV
96- #
97- # - name: Show environment
98- # run: |
99- # env
100- # # Install the cosign tool except on PR
101- # # https://github.com/sigstore/cosign-installer
102- # - name: Install cosign
103- # if: github.event_name != 'pull_request'
104- # uses: sigstore/cosign-installer@1e95c1de343b5b0c23352d6417ee3e48d5bcd422
105- # with:
106- # cosign-release: 'v1.4.0'
107- # # Workaround: https://github.com/docker/build-push-action/issues/461
108- # - name: Setup Docker buildx
109- # uses: docker/setup-buildx-action@79abd3f86f79a9d68a23c75a09a9a85889262adf
110- # # Login against a Docker registry except on PR
111- # # https://github.com/docker/login-action
112- # - name: Log into registry ${{ env.REGISTRY }}
113- # if: github.event_name != 'pull_request'
114- # uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
115- # with:
116- # registry: ${{ env.REGISTRY }}
117- # username: ${{ github.actor }}
118- # password: ${{ secrets.GITHUB_TOKEN }}
119- #
120- # # Extract metadata (tags, labels) for Docker
121- # # https://github.com/docker/metadata-action
122- # - name: Extract Docker metadata
123- # id: meta
124- # uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
125- # with:
126- # images: ${{ env.IMAGE }}
127- # # Build and push Docker image with Buildx (don't push on PR)
128- # # https://github.com/docker/build-push-action
129- # - name: Build and push Docker image
130- # id: build-and-push
131- # uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
132- # with:
133- # context: .
134- # push: ${{ github.event_name != 'pull_request' }}
135- # tags: |
136- # ${{ env.IMAGE }}:latest
137- # ${{ env.IMAGE }}:${{ env.GIT_SHA }}
138- # # Sign the resulting Docker image digest except on PRs.
139- # # This will only write to the public Rekor transparency log when the Docker
140- # # repository is public to avoid leaking data. If you would like to publish
141- # # transparency data even for private images, pass --force to cosign below.
142- # # https://github.com/sigstore/cosign
143- # - name: Sign the published Docker image
144- # if: ${{ github.event_name != 'pull_request' }}
145- # env:
146- # COSIGN_EXPERIMENTAL: "true"
147- # # This step uses the identity token to provision an ephemeral certificate
148- # # against the sigstore community Fulcio instance.
149- # run: cosign sign ${{ env.IMAGE }}@${{ steps.build-and-push.outputs.digest }}
75+ docker-build-and-push :
76+ # needs: r-build-and-check
77+ runs-on : ubuntu-latest
78+ permissions :
79+ contents : read
80+ packages : write
81+ # This is used to complete the identity challenge
82+ # with sigstore/fulcio when running outside of PRs.
83+ id-token : write
84+ steps :
85+ - name : Checkout repository
86+ uses : actions/checkout@v2
87+
88+ - name : Set Environment Variables
89+ run : |
90+ REPO_LOWER="$(echo "${{ github.repository }}" | tr '[:upper:]' '[:lower:]')"
91+ REGISTRY=ghcr.io
92+ echo "BUILD_DATE=$(date +'%Y-%m-%d %H:%M:%S')" >> $GITHUB_ENV
93+ echo "GIT_SHA=$(echo ${{ github.sha }} | cut -c1-7)" >> $GITHUB_ENV
94+ echo "REGISTRY=${REGISTRY}" >> $GITHUB_ENV
95+ echo "IMAGE=${REGISTRY}/${REPO_LOWER}" >> $GITHUB_ENV
96+
97+ - name : Show environment
98+ run : |
99+ env
100+ # Install the cosign tool except on PR
101+ # https://github.com/sigstore/cosign-installer
102+ - name : Install cosign
103+ if : github.event_name != 'pull_request'
104+ uses : sigstore/cosign-installer@1e95c1de343b5b0c23352d6417ee3e48d5bcd422
105+ with :
106+ cosign-release : ' v1.4.0'
107+ # Workaround: https://github.com/docker/build-push-action/issues/461
108+ - name : Setup Docker buildx
109+ uses : docker/setup-buildx-action@79abd3f86f79a9d68a23c75a09a9a85889262adf
110+ # Login against a Docker registry except on PR
111+ # https://github.com/docker/login-action
112+ - name : Log into registry ${{ env.REGISTRY }}
113+ if : github.event_name != 'pull_request'
114+ uses : docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
115+ with :
116+ registry : ${{ env.REGISTRY }}
117+ username : ${{ github.actor }}
118+ password : ${{ secrets.GITHUB_TOKEN }}
119+
120+ # Extract metadata (tags, labels) for Docker
121+ # https://github.com/docker/metadata-action
122+ - name : Extract Docker metadata
123+ id : meta
124+ uses : docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
125+ with :
126+ images : ${{ env.IMAGE }}
127+ # Build and push Docker image with Buildx (don't push on PR)
128+ # https://github.com/docker/build-push-action
129+ - name : Build and push Docker image
130+ id : build-and-push
131+ uses : docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
132+ with :
133+ context : .
134+ push : ${{ github.event_name != 'pull_request' }}
135+ tags : |
136+ ${{ env.IMAGE }}:latest
137+ ${{ env.IMAGE }}:${{ env.GIT_SHA }}
138+ # Sign the resulting Docker image digest except on PRs.
139+ # This will only write to the public Rekor transparency log when the Docker
140+ # repository is public to avoid leaking data. If you would like to publish
141+ # transparency data even for private images, pass --force to cosign below.
142+ # https://github.com/sigstore/cosign
143+ - name : Sign the published Docker image
144+ if : ${{ github.event_name != 'pull_request' }}
145+ env :
146+ COSIGN_EXPERIMENTAL : " true"
147+ # This step uses the identity token to provision an ephemeral certificate
148+ # against the sigstore community Fulcio instance.
149+ run : cosign sign ${{ env.IMAGE }}@${{ steps.build-and-push.outputs.digest }}
0 commit comments