Use versioned shared module and registry credentials
This commit is contained in:
1 parent
b2ffa39148
commit
a988fdee44
10 files changed
+70
-17
No files matched your search
@@ -37,7 +37,7 @@ jobs:
|
||||
run: |
|
||||
for attempt in 1 2 3 4 5; do
|
||||
rm -rf SharedCode
|
||||
if git clone --depth 1 --branch main --single-branch https://repos.gfranz.ch/Gabriel20xx/SharedCode SharedCode; then
|
||||
if git clone --depth 1 --branch main --single-branch https://repos.gfranz.ch/Gabriel20xx/shared SharedCode; then
|
||||
break
|
||||
fi
|
||||
if [ "$attempt" -eq 5 ]; then
|
||||
@@ -60,6 +60,31 @@ jobs:
|
||||
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
||||
uses: docker/setup-qemu-action@v4
|
||||
|
||||
- name: Configure Gitea Go registry
|
||||
working-directory: ${{ github.workspace }}
|
||||
shell: bash
|
||||
env:
|
||||
PACKAGE_REGISTRY_USERNAME: ${{ secrets.PACKAGE_REGISTRY_USERNAME }}
|
||||
PACKAGE_REGISTRY_TOKEN: ${{ secrets.PACKAGE_REGISTRY_TOKEN }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
if [ -z "$PACKAGE_REGISTRY_USERNAME" ] || [ -z "$PACKAGE_REGISTRY_TOKEN" ]; then
|
||||
echo 'PACKAGE_REGISTRY_USERNAME and PACKAGE_REGISTRY_TOKEN secrets are required.' >&2
|
||||
exit 1
|
||||
fi
|
||||
netrc_path="$RUNNER_TEMP/gitea-go.netrc"
|
||||
umask 077
|
||||
{
|
||||
printf 'machine repos.gfranz.ch\n'
|
||||
printf 'login %s\n' "$PACKAGE_REGISTRY_USERNAME"
|
||||
printf 'password %s\n' "$PACKAGE_REGISTRY_TOKEN"
|
||||
} > "$netrc_path"
|
||||
{
|
||||
printf 'NETRC=%s\n' "$netrc_path"
|
||||
printf 'GOAUTH=netrc\n'
|
||||
printf 'GOPROXY=https://repos.gfranz.ch/api/packages/Gabriel20xx/go,https://proxy.golang.org\n'
|
||||
printf 'GONOSUMDB=repos.gfranz.ch/Gabriel20xx/shared/*\n'
|
||||
} >> "$GITHUB_ENV"
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v4
|
||||
|
||||
@@ -83,6 +108,8 @@ jobs:
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v7
|
||||
with:
|
||||
secret-files: |
|
||||
gitea_go_netrc=${{ runner.temp }}/gitea-go.netrc
|
||||
context: .
|
||||
file: ./docker/Dockerfile
|
||||
platforms: ${{ (github.event_name == 'push' && github.ref == 'refs/heads/main') && 'linux/amd64,linux/arm64' || 'linux/amd64' }}
|
||||
|
||||
@@ -38,7 +38,7 @@ jobs:
|
||||
run: |
|
||||
for attempt in 1 2 3 4 5; do
|
||||
rm -rf SharedCode
|
||||
if git clone --depth 1 --branch main --single-branch https://repos.gfranz.ch/Gabriel20xx/SharedCode SharedCode; then
|
||||
if git clone --depth 1 --branch main --single-branch https://repos.gfranz.ch/Gabriel20xx/shared SharedCode; then
|
||||
break
|
||||
fi
|
||||
if [ "$attempt" -eq 5 ]; then
|
||||
|
||||
@@ -38,7 +38,7 @@ jobs:
|
||||
run: |
|
||||
for attempt in 1 2 3 4 5; do
|
||||
rm -rf SharedCode
|
||||
if git clone --depth 1 --branch main --single-branch https://repos.gfranz.ch/Gabriel20xx/SharedCode SharedCode; then
|
||||
if git clone --depth 1 --branch main --single-branch https://repos.gfranz.ch/Gabriel20xx/shared SharedCode; then
|
||||
break
|
||||
fi
|
||||
if [ "$attempt" -eq 5 ]; then
|
||||
@@ -49,6 +49,31 @@ jobs:
|
||||
sleep "$delay"
|
||||
done
|
||||
|
||||
- name: Configure Gitea Go registry
|
||||
working-directory: ${{ github.workspace }}
|
||||
shell: bash
|
||||
env:
|
||||
PACKAGE_REGISTRY_USERNAME: ${{ secrets.PACKAGE_REGISTRY_USERNAME }}
|
||||
PACKAGE_REGISTRY_TOKEN: ${{ secrets.PACKAGE_REGISTRY_TOKEN }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
if [ -z "$PACKAGE_REGISTRY_USERNAME" ] || [ -z "$PACKAGE_REGISTRY_TOKEN" ]; then
|
||||
echo 'PACKAGE_REGISTRY_USERNAME and PACKAGE_REGISTRY_TOKEN secrets are required.' >&2
|
||||
exit 1
|
||||
fi
|
||||
netrc_path="$RUNNER_TEMP/gitea-go.netrc"
|
||||
umask 077
|
||||
{
|
||||
printf 'machine repos.gfranz.ch\n'
|
||||
printf 'login %s\n' "$PACKAGE_REGISTRY_USERNAME"
|
||||
printf 'password %s\n' "$PACKAGE_REGISTRY_TOKEN"
|
||||
} > "$netrc_path"
|
||||
{
|
||||
printf 'NETRC=%s\n' "$netrc_path"
|
||||
printf 'GOAUTH=netrc\n'
|
||||
printf 'GOPROXY=https://repos.gfranz.ch/api/packages/Gabriel20xx/go,https://proxy.golang.org\n'
|
||||
printf 'GONOSUMDB=repos.gfranz.ch/Gabriel20xx/shared/*\n'
|
||||
} >> "$GITHUB_ENV"
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
@@ -77,7 +102,7 @@ jobs:
|
||||
run: |
|
||||
for attempt in 1 2 3 4 5; do
|
||||
rm -rf SharedCode
|
||||
if git clone --depth 1 --branch main --single-branch https://repos.gfranz.ch/Gabriel20xx/SharedCode SharedCode; then
|
||||
if git clone --depth 1 --branch main --single-branch https://repos.gfranz.ch/Gabriel20xx/shared SharedCode; then
|
||||
break
|
||||
fi
|
||||
if [ "$attempt" -eq 5 ]; then
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
[submodule "SharedCode"]
|
||||
path = SharedCode
|
||||
url = https://repos.gfranz.ch/Gabriel20xx/SharedCode
|
||||
url = https://repos.gfranz.ch/Gabriel20xx/shared
|
||||
branch = main
|
||||
+1
-1
@@ -12,7 +12,7 @@ import (
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
sharedauth "repos.gfranz.ch/Gabriel20xx/SharedCode/backend/auth"
|
||||
sharedauth "repos.gfranz.ch/Gabriel20xx/shared/backend/auth"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
+2
-2
@@ -9,8 +9,8 @@ import (
|
||||
"github.com/jackc/pgx/v5"
|
||||
"github.com/jackc/pgx/v5/pgxpool"
|
||||
|
||||
sharedauth "repos.gfranz.ch/Gabriel20xx/SharedCode/backend/auth"
|
||||
sharedpostgres "repos.gfranz.ch/Gabriel20xx/SharedCode/backend/postgres"
|
||||
sharedauth "repos.gfranz.ch/Gabriel20xx/shared/backend/auth"
|
||||
sharedpostgres "repos.gfranz.ch/Gabriel20xx/shared/backend/postgres"
|
||||
)
|
||||
|
||||
// DB owns the PostgreSQL pool. The schema deliberately uses the same physical
|
||||
|
||||
+1
-3
@@ -15,7 +15,5 @@ require (
|
||||
github.com/jackc/puddle/v2 v2.2.2 // indirect
|
||||
golang.org/x/sync v0.22.0 // indirect
|
||||
golang.org/x/text v0.40.0 // indirect
|
||||
repos.gfranz.ch/Gabriel20xx/SharedCode/backend v0.0.0
|
||||
repos.gfranz.ch/Gabriel20xx/shared/backend v0.1.0
|
||||
)
|
||||
|
||||
replace repos.gfranz.ch/Gabriel20xx/SharedCode/backend => ../SharedCode/backend
|
||||
+6
-3
@@ -3,7 +3,7 @@ RUN apk add --no-cache git
|
||||
WORKDIR /frontend
|
||||
COPY frontend/package*.json ./
|
||||
RUN --mount=type=bind,source=SharedCode.git,target=/tmp/SharedCode.git,readonly \
|
||||
git config --global url."file:///tmp/SharedCode.git".insteadOf "https://repos.gfranz.ch/Gabriel20xx/SharedCode" && \
|
||||
git config --global url."file:///tmp/SharedCode.git".insteadOf "https://repos.gfranz.ch/Gabriel20xx/shared" && \
|
||||
for attempt in 1 2 3 4 5; do \
|
||||
npm ci && break; \
|
||||
if [ "$attempt" -eq 5 ]; then exit 1; fi; \
|
||||
@@ -17,8 +17,11 @@ RUN npm run build
|
||||
FROM golang:1.26-alpine AS builder
|
||||
WORKDIR /app
|
||||
COPY backend/go.mod backend/go.sum ./
|
||||
COPY SharedCode/backend/ /SharedCode/backend/
|
||||
RUN go mod download
|
||||
RUN --mount=type=secret,id=gitea_go_netrc,target=/root/.netrc,required \
|
||||
GOPROXY="https://repos.gfranz.ch/api/packages/Gabriel20xx/go,https://proxy.golang.org" \
|
||||
GONOSUMDB="repos.gfranz.ch/Gabriel20xx/shared/*" \
|
||||
GOAUTH=netrc \
|
||||
go mod download
|
||||
COPY backend/*.go ./
|
||||
COPY --from=frontend-builder /frontend/build ./web
|
||||
RUN apk add --no-cache ca-certificates && \
|
||||
|
||||
Generated
+2
-2
@@ -8,7 +8,7 @@
|
||||
"name": "collabtable-server-frontend",
|
||||
"version": "1.0.0",
|
||||
"dependencies": {
|
||||
"@gabriel20xx/shared-code": "git+https://repos.gfranz.ch/Gabriel20xx/SharedCode#main",
|
||||
"@gabriel20xx/shared-code": "git+https://repos.gfranz.ch/Gabriel20xx/shared#main",
|
||||
"@lucide/svelte": "latest",
|
||||
"@tanstack/svelte-query": "latest",
|
||||
"bits-ui": "latest",
|
||||
@@ -220,7 +220,7 @@
|
||||
},
|
||||
"node_modules/@gabriel20xx/shared-code": {
|
||||
"version": "0.1.0",
|
||||
"resolved": "git+https://repos.gfranz.ch/Gabriel20xx/SharedCode#main",
|
||||
"resolved": "git+https://repos.gfranz.ch/Gabriel20xx/shared#main",
|
||||
"license": "MIT",
|
||||
"workspaces": [
|
||||
"packages/*"
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
"vite": "latest"
|
||||
},
|
||||
"dependencies": {
|
||||
"@gabriel20xx/shared-code": "git+https://repos.gfranz.ch/Gabriel20xx/SharedCode#main",
|
||||
"@gabriel20xx/shared-code": "git+https://repos.gfranz.ch/Gabriel20xx/shared#main",
|
||||
"@lucide/svelte": "latest",
|
||||
"@tanstack/svelte-query": "latest",
|
||||
"bits-ui": "latest",
|
||||
|
||||
Reference in new issue
Block a user