This commit is contained in:
@@ -19,6 +19,10 @@ jobs:
|
||||
DEPLOY_USER: ${{ secrets.DEPLOY_USER }}
|
||||
DEPLOY_PATH: ${{ secrets.DEPLOY_PATH }}
|
||||
DEPLOY_SSH_KEY: ${{ secrets.DEPLOY_SSH_KEY }}
|
||||
GITEA_BASE_URL: ${{ secrets.GITEA_BASE_URL }}
|
||||
GITEA_PACKAGE_OWNER: ${{ secrets.GITEA_PACKAGE_OWNER }}
|
||||
GITEA_PACKAGE_USER: ${{ secrets.GITEA_PACKAGE_USER }}
|
||||
GITEA_PACKAGE_TOKEN: ${{ secrets.GITEA_PACKAGE_TOKEN }}
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
@@ -40,6 +44,26 @@ jobs:
|
||||
- name: Create deployment artifact
|
||||
run: bash scripts/build-deploy-artifact.sh
|
||||
|
||||
- name: Publish deployment package
|
||||
run: |
|
||||
test -n "${GITEA_PACKAGE_USER}"
|
||||
test -n "${GITEA_PACKAGE_TOKEN}"
|
||||
|
||||
BASE_URL="${GITEA_BASE_URL:-${GITHUB_SERVER_URL}}"
|
||||
PACKAGE_OWNER="${GITEA_PACKAGE_OWNER:-${GITHUB_REPOSITORY_OWNER}}"
|
||||
PACKAGE_NAME="alrahma_sunday_school"
|
||||
REF_NAME="${GITHUB_REF_NAME:-manual}"
|
||||
SHORT_SHA="$(printf '%s' "${GITHUB_SHA}" | cut -c1-7)"
|
||||
VERSION="$(printf '%s-%s-%s' "${REF_NAME}" "${GITHUB_RUN_NUMBER}" "${SHORT_SHA}" | sed 's/[^A-Za-z0-9._+-]/-/g')"
|
||||
FILE_NAME="${PACKAGE_NAME}-${VERSION}.tar.gz"
|
||||
|
||||
tar -czf "build/${FILE_NAME}" -C build/deploy .
|
||||
|
||||
curl --fail-with-body \
|
||||
--user "${GITEA_PACKAGE_USER}:${GITEA_PACKAGE_TOKEN}" \
|
||||
--upload-file "build/${FILE_NAME}" \
|
||||
"${BASE_URL}/api/packages/${PACKAGE_OWNER}/generic/${PACKAGE_NAME}/${VERSION}/${FILE_NAME}"
|
||||
|
||||
- name: Configure SSH
|
||||
run: |
|
||||
test -n "${DEPLOY_HOST}"
|
||||
|
||||
@@ -32,3 +32,23 @@ Excluded:
|
||||
- runtime cache, logs, sessions, uploads, and generated reports
|
||||
|
||||
The server keeps its own `.env` and runtime `writable/` contents. The deploy job syncs from `build/deploy/` and excludes mutable writable subdirectories so production data is not overwritten.
|
||||
|
||||
## Gitea Package
|
||||
|
||||
The deploy workflow also archives `build/deploy/` and publishes it to Gitea Packages as a generic package:
|
||||
|
||||
- Package name: `alrahma_sunday_school`
|
||||
- Version format: `{branch}-{run_number}-{short_sha}`
|
||||
- File format: `alrahma_sunday_school-{version}.tar.gz`
|
||||
|
||||
Required repository secrets for package publishing:
|
||||
|
||||
- `GITEA_PACKAGE_USER`
|
||||
- `GITEA_PACKAGE_TOKEN`
|
||||
|
||||
Optional repository secrets:
|
||||
|
||||
- `GITEA_BASE_URL` - defaults to the Actions server URL.
|
||||
- `GITEA_PACKAGE_OWNER` - defaults to the repository owner.
|
||||
|
||||
The token must have permission to publish packages for the package owner.
|
||||
|
||||
Reference in New Issue
Block a user