fix:fix workflow
This commit is contained in:
@@ -3,14 +3,21 @@ name: offline-release
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
package-and-deploy:
|
||||
runs-on: build-host
|
||||
steps:
|
||||
- name: Prepare local worktree
|
||||
env:
|
||||
MAIBOT_REPO_URL: http://127.0.0.1:3000/${{ gitea.repository }}.git
|
||||
MAIBOT_REPO_SHA: ${{ gitea.sha }}
|
||||
MAIBOT_REPO_REF: ${{ gitea.ref }}
|
||||
MAIBOT_REPOSITORY: ${{ gitea.repository }}
|
||||
MAIBOT_SERVER_URL: ${{ gitea.server_url }}
|
||||
MAIBOT_REPO_URL: ${{ vars.MAIBOT_REPO_URL }}
|
||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||
shell: bash
|
||||
run: |
|
||||
set -euo pipefail
|
||||
@@ -20,14 +27,29 @@ jobs:
|
||||
|
||||
rm -rf "$worktree"
|
||||
mkdir -p "$worktree_root"
|
||||
printf 'MAIBOT_WORKTREE=%s\n' "$worktree" >> "$GITHUB_ENV"
|
||||
|
||||
git clone --no-checkout "$MAIBOT_REPO_URL" "$worktree"
|
||||
git -C "$worktree" checkout --force "$MAIBOT_REPO_SHA"
|
||||
repo_url="${MAIBOT_REPO_URL:-${MAIBOT_SERVER_URL%/}/${MAIBOT_REPOSITORY}.git}"
|
||||
auth_header="Authorization: token ${GITEA_TOKEN}"
|
||||
|
||||
echo "Resolving repository source: $repo_url"
|
||||
git -c http.lowSpeedLimit=1 \
|
||||
-c http.lowSpeedTime=30 \
|
||||
-c http.extraHeader="$auth_header" \
|
||||
ls-remote "$repo_url" "$MAIBOT_REPO_REF"
|
||||
|
||||
git init "$worktree"
|
||||
git -C "$worktree" remote add origin "$repo_url"
|
||||
git -C "$worktree" \
|
||||
-c http.lowSpeedLimit=1 \
|
||||
-c http.lowSpeedTime=30 \
|
||||
-c http.extraHeader="$auth_header" \
|
||||
fetch --depth=1 origin "$MAIBOT_REPO_SHA"
|
||||
git -C "$worktree" checkout --force FETCH_HEAD
|
||||
git -C "$worktree" clean -dffx
|
||||
|
||||
app_tag="$(git -C "$worktree" rev-parse --short=12 HEAD)"
|
||||
printf 'APP_TAG=%s\n' "$app_tag" >> "$GITHUB_ENV"
|
||||
printf 'MAIBOT_WORKTREE=%s\n' "$worktree" >> "$GITHUB_ENV"
|
||||
|
||||
- name: Stage release directory
|
||||
shell: bash
|
||||
|
||||
Reference in New Issue
Block a user