Skip to content

Commit dc94699

Browse files
committed
ci: add publish action
1 parent ab4021d commit dc94699

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

.github/workflows/publish.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Publish
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
8+
env:
9+
REGISTRY: ghcr.io
10+
IMAGE_NAME: ${{ github.repository }}
11+
DOCKER_USER: ${{ github.actor }}
12+
DOCKER_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
13+
14+
jobs:
15+
publish:
16+
name: Publish
17+
runs-on: ubuntu-latest
18+
permissions:
19+
contents: read
20+
packages: write
21+
attestations: write
22+
id-token: write
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v4
26+
with:
27+
fetch-depth: 0
28+
- name: Login to Container Registry
29+
uses: docker/login-action@v3
30+
with:
31+
registry: ${{ env.REGISTRY }}
32+
username: ${{ env.DOCKER_USER }}
33+
password: ${{ env.DOCKER_PASSWORD }}
34+
- name: Get metadata
35+
uses: docker/metadata-action@v4
36+
id: meta
37+
with:
38+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
39+
- name: Build and push
40+
uses: docker/build-push-action@v4
41+
with:
42+
context: .
43+
push: ${{ github.event_name != 'pull_request' }}
44+
tags: ${{ steps.meta.outputs.tags }}
45+
labels: ${{ steps.meta.outputs.labels }}
46+
cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
47+
cache-to: type=inline

0 commit comments

Comments
 (0)