Skip to content

Commit d2abc7d

Browse files
committed
feat: add build pipeline
1 parent 903c618 commit d2abc7d

File tree

3 files changed

+64
-15
lines changed

3 files changed

+64
-15
lines changed

.github/workflows/ci.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: ci
2+
3+
on:
4+
push:
5+
# branches:
6+
# - main
7+
8+
env:
9+
TEST_TAG: registry.work.soren.codes/portfolio:test
10+
LATEST_TAG: registry.work.soren.codes/portfolio:latest
11+
12+
jobs:
13+
docker:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Login to registry
17+
uses: docker/login-action@v3
18+
with:
19+
registry: registry.work.soren.codes
20+
username: ${{ secrets.REGISTRY_USER }}
21+
password: ${{ secrets.REGISTRY_PASSWORD }}
22+
23+
- name: Checkout
24+
uses: actions/checkout@v4
25+
26+
- name: Set up QEMU
27+
uses: docker/setup-qemu-action@v3
28+
29+
- name: Set up Docker Buildx
30+
uses: docker/setup-buildx-action@v3
31+
32+
- name: Build and load
33+
uses: docker/build-push-action@v6
34+
with:
35+
load: true
36+
tags: ${{ env.TEST_TAG }}
37+
38+
- name: Test
39+
run: |
40+
docker run --rm ${{ env.TEST_TAG }}
41+
42+
- name: Build and push
43+
uses: docker/build-push-action@v6
44+
with:
45+
push: true
46+
tags: ${{ env.LATEST_TAG }}
47+
build-args: |
48+
REPOSITORY=${{ github.repository }}
49+
PREVIEW_SITE=${{ secrets.PREVIEW_SITE }}
50+
KEYSTATIC_GITHUB_CLIENT_ID=${{ secrets.KEYSTATIC_GITHUB_CLIENT_ID }}
51+
KEYSTATIC_GITHUB_CLIENT_SECRET=${{ secrets.KEYSTATIC_GITHUB_CLIENT_SECRET }}
52+
KEYSTATIC_SECRET=${{ secrets.KEYSTATIC_SECRET }}
53+
PUBLIC_KEYSTATIC_GITHUB_APP_SLUG=${{ secrets.PUBLIC_KEYSTATIC_GITHUB_APP_SLUG }}
54+
RESEND_API_KEY=${{ secrets.RESEND_API_KEY }}
55+
EMAIL_USER=${{ secrets.EMAIL_USER }}
56+
EMAIL_TARGET=${{ secrets.EMAIL_TARGET }}
57+
BRAND_NAME=${{ vars.BRAND_NAME }}
58+
BRAND_DESCRIPTION=${{ vars.BRAND_DESCRIPTION }}
59+
BRAND_LOGO=${{ vars.BRAND_LOGO }}
60+
BRAND_TWITTER=${{ vars.BRAND_TWITTER }}

astro.config.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,7 @@ export default defineConfig({
3232
context: 'client',
3333
access: 'public',
3434
}),
35-
REPO_OWNER: envField.string({
36-
context: 'client',
37-
access: 'public',
38-
}),
39-
REPO_NAME: envField.string({
35+
REPOSITORY: envField.string({
4036
context: 'client',
4137
access: 'public',
4238
}),

keystatic.config.ts

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
11
import { config } from '@keystatic/core';
2-
import {
3-
BRAND_LOGO,
4-
BRAND_NAME,
5-
REPO_NAME,
6-
REPO_OWNER,
7-
} from 'astro:env/client';
2+
import { BRAND_LOGO, BRAND_NAME, REPOSITORY } from 'astro:env/client';
83

94
import { pageCollection } from '@/collections/page.collection';
105
import { logomark } from '@/components/content/logomark.content';
116
import { settingsSingleton } from '@/collections/settings.singleton';
7+
import type { RepoConfig } from 'node_modules/@keystatic/core/dist/declarations/src/app/repo-config';
128

139
export default config({
1410
ui: {
@@ -28,10 +24,7 @@ export default config({
2824
}
2925
: {
3026
kind: 'github',
31-
repo: {
32-
owner: REPO_OWNER,
33-
name: REPO_NAME,
34-
},
27+
repo: REPOSITORY as `${string}/${string}`,
3528
branchPrefix: 'preview',
3629
},
3730
collections: {

0 commit comments

Comments
 (0)