Skip to content

Commit ab83cc8

Browse files
authored
Solve docker problem. (#1268)
corrected docker action.
1 parent 755dcf3 commit ab83cc8

File tree

1 file changed

+17
-49
lines changed

1 file changed

+17
-49
lines changed

.github/workflows/docker-publish.yml

+17-49
Original file line numberDiff line numberDiff line change
@@ -1,92 +1,60 @@
11
name: Docker
22

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.
7-
83
on:
94
push:
10-
branches: [ "dev" ]
11-
# Publish version tags as releases.
12-
tags: [ 'v*.*.*' ]
13-
14-
env:
15-
# Use docker.io for Docker Hub if empty
16-
REGISTRY: ghcr.io
17-
# github.repository as <account>/<repo>
18-
IMAGE_NAME: ${{ github.repository }}
19-
5+
branches:
6+
- dev
7+
- master
8+
tags:
9+
- v*
10+
workflow_dispatch:
2011

2112
jobs:
2213
build:
23-
2414
runs-on: ubuntu-latest
2515
permissions:
2616
contents: read
2717
packages: write
28-
# This is used to complete the identity challenge
29-
# with sigstore/fulcio when running outside of PRs.
3018
id-token: write
3119

3220
steps:
3321
- name: Checkout repository
3422
uses: actions/checkout@v3
3523

36-
# Install the cosign tool except on PR
37-
# https://github.com/sigstore/cosign-installer
3824
- name: Install cosign
39-
if: github.event_name != 'pull_request'
40-
uses: sigstore/cosign-installer@f3c664df7af409cb4873aa5068053ba9d61a57b6 #v2.6.0
41-
with:
42-
cosign-release: 'v1.11.0'
25+
uses: sigstore/cosign-installer@main
4326

27+
- name: Check cosign install
28+
run: cosign version
4429

45-
# Workaround: https://github.com/docker/build-push-action/issues/461
4630
- name: Setup Docker buildx
47-
uses: docker/setup-buildx-action@79abd3f86f79a9d68a23c75a09a9a85889262adf
31+
uses: docker/setup-buildx-action@v2
4832

49-
# Login against a Docker registry except on PR
50-
# https://github.com/docker/login-action
51-
- name: Log into registry ${{ env.REGISTRY }}
52-
if: github.event_name != 'pull_request'
53-
uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
33+
- name: Login ghcr.io
34+
uses: docker/login-action@v2
5435
with:
55-
registry: ${{ env.REGISTRY }}
36+
registry: ghcr.io
5637
username: ${{ github.actor }}
5738
password: ${{ secrets.GITHUB_TOKEN }}
5839

59-
# Extract metadata (tags, labels) for Docker
60-
# https://github.com/docker/metadata-action
6140
- name: Extract Docker metadata
6241
id: meta
63-
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
42+
uses: docker/metadata-action@v4
6443
with:
65-
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
44+
images: ghcr.io/${{ github.repository }}
6645

67-
# Build and push Docker image with Buildx (don't push on PR)
68-
# https://github.com/docker/build-push-action
6946
- name: Build and push Docker image
7047
id: build-and-push
71-
uses: docker/build-push-action@ac9327eae2b366085ac7f6a2d02df8aa8ead720a
48+
uses: docker/build-push-action@v3
7249
with:
7350
context: .
74-
push: ${{ github.event_name != 'pull_request' }}
51+
push: true
7552
tags: ${{ steps.meta.outputs.tags }}
7653
labels: ${{ steps.meta.outputs.labels }}
7754
cache-from: type=gha
7855
cache-to: type=gha,mode=max
7956

80-
81-
# Sign the resulting Docker image digest except on PRs.
82-
# This will only write to the public Rekor transparency log when the Docker
83-
# repository is public to avoid leaking data. If you would like to publish
84-
# transparency data even for private images, pass --force to cosign below.
85-
# https://github.com/sigstore/cosign
8657
- name: Sign the published Docker image
87-
if: ${{ github.event_name != 'pull_request' }}
8858
env:
8959
COSIGN_EXPERIMENTAL: "true"
90-
# This step uses the identity token to provision an ephemeral certificate
91-
# against the sigstore community Fulcio instance.
9260
run: echo "${{ steps.meta.outputs.tags }}" | xargs -I {} cosign sign {}@${{ steps.build-and-push.outputs.digest }}

0 commit comments

Comments
 (0)