Skip to content

Commit f7f9cd9

Browse files
authored
Merge pull request #1 from eurosky-social/bailey/ghcr-builds
Add GitHub workflow to publish image to GHCR
2 parents 53159b7 + 7d2826b commit f7f9cd9

1 file changed

Lines changed: 57 additions & 0 deletions

File tree

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Publish image
2+
3+
on:
4+
push:
5+
branches: [eurosky]
6+
tags: ["v*"]
7+
pull_request:
8+
branches: [eurosky]
9+
workflow_dispatch:
10+
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.ref }}
13+
cancel-in-progress: true
14+
15+
env:
16+
REGISTRY: ghcr.io
17+
IMAGE_NAME: ${{ github.repository }}
18+
19+
jobs:
20+
build:
21+
runs-on: ubuntu-latest
22+
permissions:
23+
contents: read
24+
packages: write
25+
steps:
26+
- uses: actions/checkout@v7
27+
28+
- uses: docker/setup-buildx-action@v4
29+
30+
- uses: docker/login-action@v4
31+
if: github.event_name != 'pull_request'
32+
with:
33+
registry: ${{ env.REGISTRY }}
34+
username: ${{ github.actor }}
35+
password: ${{ secrets.GITHUB_TOKEN }}
36+
37+
- id: meta
38+
uses: docker/metadata-action@v6
39+
with:
40+
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
41+
tags: |
42+
# latest tracks the eurosky branch
43+
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/eurosky' }}
44+
type=ref,event=branch
45+
type=ref,event=pr
46+
type=semver,pattern={{version}}
47+
type=semver,pattern={{major}}.{{minor}}
48+
type=sha,format=long
49+
50+
- uses: docker/build-push-action@v7
51+
with:
52+
context: .
53+
push: ${{ github.event_name != 'pull_request' }}
54+
tags: ${{ steps.meta.outputs.tags }}
55+
labels: ${{ steps.meta.outputs.labels }}
56+
cache-from: type=gha
57+
cache-to: type=gha,mode=max

0 commit comments

Comments
 (0)