ops: move to forgejo-primary hosting with mirror-only codeberg/github
This commit is contained in:
parent
a5bc6c5226
commit
043b1730dc
18 changed files with 336 additions and 66 deletions
|
|
@ -11,6 +11,7 @@ concurrency:
|
|||
|
||||
jobs:
|
||||
checks:
|
||||
if: ${{ github.server_url != 'https://codeberg.org' }}
|
||||
runs-on: codeberg-medium-lazy
|
||||
steps:
|
||||
- name: Fetch Source (no git required)
|
||||
|
|
@ -35,12 +36,20 @@ jobs:
|
|||
echo "error: missing GITHUB_SHA"
|
||||
exit 2
|
||||
fi
|
||||
if [[ -z "${GITHUB_SERVER_URL:-}" ]]; then
|
||||
echo "error: missing GITHUB_SERVER_URL"
|
||||
exit 2
|
||||
fi
|
||||
if [[ -z "${GITHUB_REPOSITORY:-}" ]]; then
|
||||
echo "error: missing GITHUB_REPOSITORY"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
rm -rf .repo
|
||||
mkdir -p .repo
|
||||
|
||||
curl -fsSL -H "Authorization: token ${GITHUB_TOKEN}" \
|
||||
"https://codeberg.org/api/v1/repos/every-channel/every.channel/archive/${GITHUB_SHA}.tar.gz?rev=${GITHUB_SHA}" \
|
||||
"${GITHUB_SERVER_URL}/api/v1/repos/${GITHUB_REPOSITORY}/archive/${GITHUB_SHA}.tar.gz?rev=${GITHUB_SHA}" \
|
||||
-o .repo/src.tgz
|
||||
tar -xzf .repo/src.tgz -C .repo --strip-components=1
|
||||
rm -f .repo/src.tgz
|
||||
|
|
@ -111,6 +120,7 @@ jobs:
|
|||
env -u NO_COLOR trunk build --release --public-url /
|
||||
|
||||
deploy:
|
||||
if: ${{ github.server_url != 'https://codeberg.org' }}
|
||||
needs: checks
|
||||
runs-on: codeberg-medium-lazy
|
||||
steps:
|
||||
|
|
@ -136,13 +146,21 @@ jobs:
|
|||
echo "error: missing GITHUB_SHA"
|
||||
exit 2
|
||||
fi
|
||||
if [[ -z "${GITHUB_SERVER_URL:-}" ]]; then
|
||||
echo "error: missing GITHUB_SERVER_URL"
|
||||
exit 2
|
||||
fi
|
||||
if [[ -z "${GITHUB_REPOSITORY:-}" ]]; then
|
||||
echo "error: missing GITHUB_REPOSITORY"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
rm -rf .repo
|
||||
mkdir -p .repo
|
||||
|
||||
# Use the authenticated API archive endpoint (works for private repos).
|
||||
curl -fsSL -H "Authorization: token ${GITHUB_TOKEN}" \
|
||||
"https://codeberg.org/api/v1/repos/every-channel/every.channel/archive/${GITHUB_SHA}.tar.gz?rev=${GITHUB_SHA}" \
|
||||
"${GITHUB_SERVER_URL}/api/v1/repos/${GITHUB_REPOSITORY}/archive/${GITHUB_SHA}.tar.gz?rev=${GITHUB_SHA}" \
|
||||
-o .repo/src.tgz
|
||||
tar -xzf .repo/src.tgz -C .repo --strip-components=1
|
||||
rm -f .repo/src.tgz
|
||||
|
|
@ -211,7 +229,7 @@ jobs:
|
|||
cd .repo
|
||||
curl -fsSL -X POST -H "Authorization: token ${GITHUB_TOKEN}" \
|
||||
-H "content-type: application/json" \
|
||||
"https://codeberg.org/api/v1/repos/every-channel/every.channel/statuses/${GITHUB_SHA}" \
|
||||
"${GITHUB_SERVER_URL}/api/v1/repos/${GITHUB_REPOSITORY}/statuses/${GITHUB_SHA}" \
|
||||
-d '{"context":"deploy-cloudflare/breadcrumb","state":"pending","description":"bootstrap ok"}' >/dev/null
|
||||
|
||||
- name: Configure CI Age identity
|
||||
|
|
@ -236,7 +254,7 @@ jobs:
|
|||
|
||||
curl -fsSL -X POST -H "Authorization: token ${GITHUB_TOKEN}" \
|
||||
-H "content-type: application/json" \
|
||||
"https://codeberg.org/api/v1/repos/every-channel/every.channel/statuses/${GITHUB_SHA}" \
|
||||
"${GITHUB_SERVER_URL}/api/v1/repos/${GITHUB_REPOSITORY}/statuses/${GITHUB_SHA}" \
|
||||
-d '{"context":"deploy-cloudflare/breadcrumb","state":"pending","description":"age key ok"}' >/dev/null
|
||||
|
||||
- name: Decrypt CI secrets from repo
|
||||
|
|
@ -262,7 +280,7 @@ jobs:
|
|||
|
||||
curl -fsSL -X POST -H "Authorization: token ${GITHUB_TOKEN}" \
|
||||
-H "content-type: application/json" \
|
||||
"https://codeberg.org/api/v1/repos/every-channel/every.channel/statuses/${GITHUB_SHA}" \
|
||||
"${GITHUB_SERVER_URL}/api/v1/repos/${GITHUB_REPOSITORY}/statuses/${GITHUB_SHA}" \
|
||||
-d '{"context":"deploy-cloudflare/breadcrumb","state":"pending","description":"decrypt ok"}' >/dev/null
|
||||
|
||||
- name: Build site (web)
|
||||
|
|
@ -301,7 +319,7 @@ jobs:
|
|||
|
||||
curl -fsSL -X POST -H "Authorization: token ${GITHUB_TOKEN}" \
|
||||
-H "content-type: application/json" \
|
||||
"https://codeberg.org/api/v1/repos/every-channel/every.channel/statuses/${GITHUB_SHA}" \
|
||||
"${GITHUB_SERVER_URL}/api/v1/repos/${GITHUB_REPOSITORY}/statuses/${GITHUB_SHA}" \
|
||||
-d '{"context":"deploy-cloudflare/breadcrumb","state":"pending","description":"build ok"}' >/dev/null
|
||||
|
||||
- name: Deploy worker
|
||||
|
|
@ -317,5 +335,5 @@ jobs:
|
|||
|
||||
curl -fsSL -X POST -H "Authorization: token ${GITHUB_TOKEN}" \
|
||||
-H "content-type: application/json" \
|
||||
"https://codeberg.org/api/v1/repos/every-channel/every.channel/statuses/${GITHUB_SHA}" \
|
||||
"${GITHUB_SERVER_URL}/api/v1/repos/${GITHUB_REPOSITORY}/statuses/${GITHUB_SHA}" \
|
||||
-d '{"context":"deploy-cloudflare/breadcrumb","state":"success","description":"deploy ok"}' >/dev/null
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue