Skip to content

Commit 5e982aa

Browse files
committed
Composed publish workflow.
1 parent f94f680 commit 5e982aa

2 files changed

Lines changed: 88 additions & 0 deletions

File tree

.github/workflows/publish.yml

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
name: Docker
2+
3+
on:
4+
push:
5+
branches: [ main]
6+
workflow_dispatch:
7+
8+
env:
9+
REGISTRY: ghcr.io
10+
IMAGE_NAME: ${{ github.repository }}
11+
12+
13+
jobs:
14+
build:
15+
16+
runs-on: ubuntu-latest
17+
permissions:
18+
contents: read
19+
packages: write
20+
id-token: write
21+
22+
steps:
23+
- name: Checkout repository
24+
uses: actions/checkout@v4
25+
26+
# Install the cosign tool except on PR
27+
# https://github.com/sigstore/cosign-installer
28+
- name: Install cosign
29+
if: github.event_name != 'pull_request'
30+
uses: sigstore/cosign-installer@59acb6260d9c0ba8f4a2f9d9b48431a222b68e20 #v3.5.0
31+
with:
32+
cosign-release: 'v2.2.4'
33+
34+
# Set up BuildKit Docker container builder to be able to build
35+
# multi-platform images and export cache
36+
# https://github.com/docker/setup-buildx-action
37+
- name: Set up Docker Buildx
38+
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0
39+
40+
# Login against a Docker registry except on PR
41+
# https://github.com/docker/login-action
42+
- name: Log into registry ${{ env.REGISTRY }}
43+
if: github.event_name != 'pull_request'
44+
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
45+
with:
46+
registry: ${{ env.REGISTRY }}
47+
username: ${{ github.actor }}
48+
password: ${{ secrets.GITHUB_TOKEN }}
49+
50+
# Extract metadata (tags, labels) for Docker
51+
# https://github.com/docker/metadata-action
52+
- name: Extract Docker metadata
53+
id: meta
54+
uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934 # v5.0.0
55+
with:
56+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
57+
58+
# Build and push Docker image with Buildx (don't push on PR)
59+
# https://github.com/docker/build-push-action
60+
- name: Build and push Docker image
61+
id: build-and-push
62+
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # v5.0.0
63+
with:
64+
context: .
65+
push: ${{ github.event_name != 'pull_request' }}
66+
tags: ${{ steps.meta.outputs.tags }}
67+
labels: ${{ steps.meta.outputs.labels }}
68+
cache-from: type=gha
69+
cache-to: type=gha,mode=max
70+
platforms: linux/amd64,linux/arm64/v8
71+
72+
73+
# Sign the resulting Docker image digest except on PRs.
74+
# This will only write to the public Rekor transparency log when the Docker
75+
# repository is public to avoid leaking data. If you would like to publish
76+
# transparency data even for private images, pass --force to cosign below.
77+
# https://github.com/sigstore/cosign
78+
- name: Sign the published Docker image
79+
if: ${{ github.event_name != 'pull_request' }}
80+
env:
81+
# https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions#using-an-intermediate-environment-variable
82+
TAGS: ${{ steps.meta.outputs.tags }}
83+
DIGEST: ${{ steps.build-and-push.outputs.digest }}
84+
# This step uses the identity token to provision an ephemeral certificate
85+
# against the sigstore community Fulcio instance.
86+
run: echo "${TAGS}" | xargs -I {} cosign sign --yes {}@${DIGEST}

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ export DATABASE_URL=<database_url>
2020
export MAILER_EMAIL=<mailer_email>
2121
export MAILER_PASSWORD=<mailer_password>
2222
export FRONTEND_URL=<frontend_url>
23+
export HTTP_PORT=5000
24+
export GRPC_PORT=5001
2325
```
2426
3. Install the protobuf-grpc compiler.
2527
```sh

0 commit comments

Comments
 (0)