Skip to content

Commit b2355a8

Browse files
Adding Release workflow
Signed-off-by: Aaron Layfield <aaron.layfield@gmail.com>
1 parent 229924b commit b2355a8

1 file changed

Lines changed: 62 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
env:
9+
REGISTRY: ghcr.io
10+
IMAGE_PREFIX: ghcr.io/${{ github.repository_owner }}/dandy-dashboard
11+
12+
jobs:
13+
build-and-push:
14+
name: Build & Push ${{ matrix.image }}
15+
runs-on: ubuntu-latest
16+
permissions:
17+
contents: read
18+
packages: write
19+
20+
strategy:
21+
matrix:
22+
include:
23+
- image: server
24+
dockerfile: docker/backend.Dockerfile
25+
- image: web
26+
dockerfile: docker/frontend.Dockerfile
27+
28+
steps:
29+
- name: Checkout
30+
uses: actions/checkout@v4
31+
32+
- name: Log in to GHCR
33+
uses: docker/login-action@v3
34+
with:
35+
registry: ${{ env.REGISTRY }}
36+
username: ${{ github.actor }}
37+
password: ${{ secrets.GITHUB_TOKEN }}
38+
39+
- name: Extract metadata
40+
id: meta
41+
uses: docker/metadata-action@v5
42+
with:
43+
images: ${{ env.IMAGE_PREFIX }}-${{ matrix.image }}
44+
tags: |
45+
type=semver,pattern={{version}}
46+
type=semver,pattern={{major}}.{{minor}}
47+
type=semver,pattern={{major}}
48+
type=sha
49+
50+
- name: Set up Docker Buildx
51+
uses: docker/setup-buildx-action@v3
52+
53+
- name: Build and push
54+
uses: docker/build-push-action@v6
55+
with:
56+
context: .
57+
file: ${{ matrix.dockerfile }}
58+
push: true
59+
tags: ${{ steps.meta.outputs.tags }}
60+
labels: ${{ steps.meta.outputs.labels }}
61+
cache-from: type=gha,scope=${{ matrix.image }}
62+
cache-to: type=gha,mode=max,scope=${{ matrix.image }}

0 commit comments

Comments
 (0)