Skip to content

Commit f030c93

Browse files
committed
Merge branch 'main' into fix/issue-23
2 parents 2ba62ae + 062cdc3 commit f030c93

44 files changed

Lines changed: 2712 additions & 1908 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ coverage
1414
.nyc_output
1515

1616
# Production build
17+
build
1718
dist
1819

1920
# Misc

.env

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
VITE_APP_VERSION="1.0.0"
1+
VITE_APP_VERSION="1.0.0" # x-release-please-version
22
VITE_APP_NAME="PostGuard"
33
VITE_MAX_UPLOAD_SIZE=2147483648
44
VITE_UPLOAD_CHUNK_SIZE=1048576

.github/workflows/ci.yml

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
name: CI
2+
#
3+
# Pipeline overview
4+
# =================
5+
#
6+
# Release-please and Docker delivery are combined in one workflow because
7+
# GITHUB_TOKEN-created tags do not trigger new workflow runs. This means a
8+
# versioned Docker image must be built in the same run that release-please
9+
# creates the release, using its job outputs to pass the version through.
10+
#
11+
12+
on:
13+
push:
14+
branches:
15+
- main
16+
pull_request:
17+
18+
jobs:
19+
20+
# Create a GitHub release (and tag) when conventional commits warrant one.
21+
release-please:
22+
name: Release Please
23+
if: github.ref == 'refs/heads/main'
24+
runs-on: ubuntu-latest
25+
permissions:
26+
contents: write
27+
pull-requests: write
28+
outputs:
29+
release_created: ${{ steps.release.outputs.release_created }}
30+
version: ${{ steps.release.outputs.version }}
31+
steps:
32+
- uses: googleapis/release-please-action@v4
33+
id: release
34+
with:
35+
release-type: node
36+
37+
# Build each platform on its native runner and push by digest (no tag yet).
38+
build:
39+
name: Build (${{ matrix.name }})
40+
runs-on: ${{ matrix.runner }}
41+
permissions:
42+
contents: read
43+
packages: write
44+
strategy:
45+
fail-fast: false
46+
matrix:
47+
include:
48+
- platform: linux/amd64
49+
runner: ubuntu-24.04
50+
name: amd64
51+
- platform: linux/arm64
52+
runner: ubuntu-24.04-arm
53+
name: arm64
54+
steps:
55+
- name: Checkout repository
56+
uses: actions/checkout@v6
57+
- name: Set up Docker Buildx
58+
uses: docker/setup-buildx-action@v4
59+
- name: Log in to GHCR
60+
uses: docker/login-action@v4
61+
with:
62+
registry: ghcr.io
63+
username: ${{ github.actor }}
64+
password: ${{ secrets.GITHUB_TOKEN }}
65+
- name: Build and push by digest
66+
id: build
67+
uses: docker/build-push-action@v7
68+
with:
69+
context: .
70+
file: docker/Dockerfile
71+
platforms: ${{ matrix.platform }}
72+
outputs: type=image,name=ghcr.io/${{ github.repository }},push-by-digest=true,name-canonical=true,push=true
73+
cache-from: type=gha
74+
cache-to: type=gha,mode=max
75+
- name: Export digest
76+
run: |
77+
mkdir -p /tmp/digests
78+
digest="${{ steps.build.outputs.digest }}"
79+
touch "/tmp/digests/${digest#sha256:}"
80+
- name: Upload digest
81+
uses: actions/upload-artifact@v7
82+
with:
83+
name: digest-${{ matrix.name }}
84+
path: /tmp/digests/*
85+
if-no-files-found: error
86+
retention-days: 1
87+
88+
# Merge platform digests into a single multi-platform manifest and apply tags.
89+
# - push to main (no release) → ghcr.io/.../postguard-website:edge
90+
# - push to main (release) → ghcr.io/.../postguard-website:edge + :1.2.3
91+
# - pull request → ghcr.io/.../postguard-website:pr-123
92+
finalize:
93+
name: Finalize Docker manifest
94+
needs: [build, release-please]
95+
if: always() && needs.build.result == 'success'
96+
runs-on: ubuntu-latest
97+
permissions:
98+
contents: read
99+
packages: write
100+
steps:
101+
- name: Download digests
102+
uses: actions/download-artifact@v8
103+
with:
104+
path: /tmp/digests
105+
pattern: digest-*
106+
merge-multiple: true
107+
- name: Docker metadata
108+
id: meta
109+
uses: docker/metadata-action@v6
110+
with:
111+
images: ghcr.io/${{ github.repository }}
112+
tags: |
113+
type=edge,branch=main
114+
type=ref,event=pr
115+
type=raw,value=${{ needs.release-please.outputs.version }},enable=${{ needs.release-please.outputs.release_created == 'true' }}
116+
- name: Set up Docker Buildx
117+
uses: docker/setup-buildx-action@v4
118+
- name: Log in to GHCR
119+
uses: docker/login-action@v4
120+
with:
121+
registry: ghcr.io
122+
username: ${{ github.actor }}
123+
password: ${{ secrets.GITHUB_TOKEN }}
124+
- name: Create and push manifest
125+
working-directory: /tmp/digests
126+
run: |
127+
docker buildx imagetools create \
128+
$(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \
129+
$(printf 'ghcr.io/${{ github.repository }}@sha256:%s ' *)

.github/workflows/docker-build.yml

Lines changed: 0 additions & 75 deletions
This file was deleted.

.release-please-manifest.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
".": "1.0.0"
3+
}

0 commit comments

Comments
 (0)