Vendor SharedCode locally
Docker / Docker Build & Push (push) Failing after 1m19s
Lint / Lint (push) Successful in 15s
Tests / Go backend (push) Successful in 19s
Tests / Dashboard checks (push) Successful in 18s

This commit is contained in:
Gabriel20xx committed 2026-08-06 15:52:56 +02:00
1 parent a8c51b8484
commit 6eb8f4ad60
88 files changed
+9708 -275

No files matched your search

@@ -0,0 +1,78 @@
name: Publish Go package
on:
push:
tags:
- 'backend/v*'
release:
types:
- published
jobs:
publish:
name: Publish shared Go module
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout source
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: backend/go.mod
cache: false
- name: Test Go module
working-directory: backend
run: go test ./...
- name: Install ZIP tools
run: sudo apt-get update && sudo apt-get install --no-install-recommends -y zip
- name: Package Go module
env:
RELEASE_TAG: ${{ github.event_name == 'release' && github.event.release.tag_name || github.ref_name }}
run: |
package_directory='gitea-go-package'
rm -rf "$package_directory"
mkdir -p "$package_directory"
bash scripts/package-go-module.sh "$RELEASE_TAG" "$package_directory"
find "$package_directory" -maxdepth 1 -type f -name '*.zip' -print -quit | grep -q .
- name: Publish to Gitea Package Registry
env:
PACKAGE_REGISTRY_USERNAME: ${{ secrets.PACKAGE_REGISTRY_USERNAME }}
PACKAGE_REGISTRY_TOKEN: ${{ secrets.PACKAGE_REGISTRY_TOKEN }}
GITEA_GO_REGISTRY: https://repos.gfranz.ch/api/packages/Gabriel20xx/go/upload
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
package_file="$(find gitea-go-package -maxdepth 1 -type f -name '*.zip' -print -quit)"
test -n "$package_file"
response_file="$(mktemp)"
http_status="$(curl --silent --show-error --fail-with-body \
--user "$PACKAGE_REGISTRY_USERNAME:$PACKAGE_REGISTRY_TOKEN" \
--output "$response_file" \
--write-out '%{http_code}' \
--upload-file "$package_file" \
"$GITEA_GO_REGISTRY" || true)"
case "$http_status" in
201)
echo 'Go package published.'
;;
409)
echo 'Go package version already exists; leaving the immutable package unchanged.'
;;
*)
cat "$response_file" >&2
echo "Gitea Go package upload failed with HTTP status $http_status." >&2
exit 1
;;
esac
@@ -0,0 +1,93 @@
name: Publish npm packages
on:
push:
tags:
- 'v*'
release:
types:
- published
jobs:
publish:
name: Publish shared npm packages
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout source
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
- name: Install and build packages
run: |
npm ci
npm run build
- name: Configure Gitea npm registry
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
npmrc_path="$RUNNER_TEMP/gitea-npmrc"
umask 077
{
printf '@gabriel20xx:registry=https://repos.gfranz.ch/api/packages/Gabriel20xx/npm/\n'
printf '//repos.gfranz.ch/api/packages/Gabriel20xx/npm/:_authToken=%s\n' "$PACKAGE_REGISTRY_TOKEN"
printf 'always-auth=true\n'
} > "$npmrc_path"
printf 'NPM_CONFIG_USERCONFIG=%s\n' "$npmrc_path" >> "$GITHUB_ENV"
- name: Publish npm packages
env:
PACKAGE_REGISTRY_USERNAME: ${{ secrets.PACKAGE_REGISTRY_USERNAME }}
PACKAGE_REGISTRY_TOKEN: ${{ secrets.PACKAGE_REGISTRY_TOKEN }}
NPM_REGISTRY: https://repos.gfranz.ch/api/packages/Gabriel20xx/npm/
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
for package in \
@gabriel20xx/design-tokens \
@gabriel20xx/web-ui \
@gabriel20xx/node-backend; do
version="$(npm pkg get version --workspace="$package" | tr -d '"[:space:]')"
package_path="${package//@/%40}"
package_path="${package_path//\//%2f}"
metadata_file="$(mktemp)"
metadata_status="$(curl --silent --show-error --fail-with-body \
--user "$PACKAGE_REGISTRY_USERNAME:$PACKAGE_REGISTRY_TOKEN" \
--output "$metadata_file" \
--write-out '%{http_code}' \
"${NPM_REGISTRY}${package_path}" || true)"
case "$metadata_status" in
200)
if grep -Fq "\"$version\"" "$metadata_file"; then
echo "$package@$version is already published; skipping."
rm -f "$metadata_file"
continue
fi
;;
404)
;;
*)
cat "$metadata_file" >&2
echo "Gitea npm metadata lookup failed with HTTP status $metadata_status." >&2
exit 1
;;
esac
npm publish --workspace="$package" --registry="$NPM_REGISTRY"
rm -f "$metadata_file"
done
@@ -0,0 +1,74 @@
name: Publish Python package
on:
push:
tags:
- 'v*'
release:
types:
- published
jobs:
publish:
name: Publish shared Python package
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Checkout source
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Build and publish package
env:
PACKAGE_REGISTRY_USERNAME: ${{ secrets.PACKAGE_REGISTRY_USERNAME }}
PACKAGE_REGISTRY_TOKEN: ${{ secrets.PACKAGE_REGISTRY_TOKEN }}
TWINE_REPOSITORY_URL: https://repos.gfranz.ch/api/packages/Gabriel20xx/pypi
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
python -m pip install --disable-pip-version-check --no-cache-dir build twine
package_directory="$RUNNER_TEMP/gitea-pypi-package"
python -m build packages/python-backend --outdir "$package_directory"
package_index_url="${TWINE_REPOSITORY_URL%/}/simple/gabriel20xx-shared-backend/"
package_index_file="$(mktemp)"
package_index_status="$(curl --silent --show-error --fail-with-body \
--user "$PACKAGE_REGISTRY_USERNAME:$PACKAGE_REGISTRY_TOKEN" \
--output "$package_index_file" \
--write-out '%{http_code}' \
"$package_index_url" || true)"
package_files=("$package_directory"/*)
files_to_upload=()
case "$package_index_status" in
200)
for package_file in "${package_files[@]}"; do
if ! grep -Fq "$(basename "$package_file")" "$package_index_file"; then
files_to_upload+=("$package_file")
fi
done
;;
404)
files_to_upload=("${package_files[@]}")
;;
*)
cat "$package_index_file" >&2
echo "Gitea PyPI package lookup failed with HTTP status $package_index_status." >&2
exit 1
;;
esac
if [ "${#files_to_upload[@]}" -eq 0 ]; then
echo 'Python package version already exists with all build artifacts; leaving it unchanged.'
exit 0
fi
TWINE_USERNAME="$PACKAGE_REGISTRY_USERNAME" \
TWINE_PASSWORD="$PACKAGE_REGISTRY_TOKEN" \
python -m twine upload --non-interactive \
--repository-url "$TWINE_REPOSITORY_URL" \
"${files_to_upload[@]}"