Skip to content

Open-source personal finance manager. Self-hosted, privacy-first.

Add release workflow to build and push Docker images to ghcr.io

Tássio Noronha8ba10453d21d
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
new file mode 100644
index 00000000..e7b8e5c1
--- /dev/null
+++ b/.github/workflows/release.yml
@@ -0,0 +1,86 @@
+name: Build and Push Docker Images
+
+on:
+ release:
+ types: [published]
+
+env:
+ REGISTRY: ghcr.io
+ IMAGE_PREFIX: ghcr.io/securo-finance
+
+permissions:
+ contents: read
+ packages: write
+
+jobs:
+ build-backend:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v4
+
+ - name: Set up Docker Buildx
+ uses: docker/setup-buildx-action@v3
+
+ - name: Log in to GitHub Container Registry
+ uses: docker/login-action@v3
+ with:
+ registry: ${{ env.REGISTRY }}
+ username: ${{ github.actor }}
+ password: ${{ secrets.GITHUB_TOKEN }}
+
+ - name: Extract metadata
+ id: meta
+ uses: docker/metadata-action@v5
+ with:
+ images: ${{ env.IMAGE_PREFIX }}/securo-backend
+ tags: |
+ type=semver,pattern={{version}}
+ type=raw,value=latest
+
+ - name: Build and push backend image
+ uses: docker/build-push-action@v6
+ with:
+ context: ./backend
+ file: ./backend/Dockerfile
+ push: true
+ tags: ${{ steps.meta.outputs.tags }}
+ labels: ${{ steps.meta.outputs.labels }}
+ cache-from: type=gha
+ cache-to: type=gha,mode=max
+
+ build-frontend:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v4
+
+ - name: Set up Docker Buildx
+ uses: docker/setup-buildx-action@v3
+
+ - name: Log in to GitHub Container Registry
+ uses: docker/login-action@v3
+ with:
+ registry: ${{ env.REGISTRY }}
+ username: ${{ github.actor }}
+ password: ${{ secrets.GITHUB_TOKEN }}
+
+ - name: Extract metadata
+ id: meta
+ uses: docker/metadata-action@v5
+ with:
+ images: ${{ env.IMAGE_PREFIX }}/securo-frontend
+ tags: |
+ type=semver,pattern={{version}}
+ type=raw,value=latest
+
+ - name: Build and push frontend image
+ uses: docker/build-push-action@v6
+ with:
+ context: ./frontend
+ file: ./frontend/Dockerfile
+ push: true
+ tags: ${{ steps.meta.outputs.tags }}
+ labels: ${{ steps.meta.outputs.labels }}
+ cache-from: type=gha
+ cache-to: type=gha,mode=max