Runner běží v host módu bez Node.js, takže actions/checkout selhal na "Cannot find: node in PATH". Checkout se dělá přímo gitem a quarto se volá plnou cestou, aby nebyl potřeba ani GITHUB_PATH. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
900194964b
commit
a66743df15
1 file changed
+30
-14
@@ -7,45 +7,61 @@ on:
|
||||
|
||||
env:
|
||||
QUARTO_VERSION: "1.10.18"
|
||||
GITEA_HOST: gitea.spacilovi.eu
|
||||
|
||||
jobs:
|
||||
build-deploy:
|
||||
# runner běží v host módu bez Node.js, proto žádné JS akce (actions/checkout apod.)
|
||||
runs-on: homelab
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
env:
|
||||
TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||
run: |
|
||||
set -e
|
||||
cd "$GITHUB_WORKSPACE"
|
||||
find . -mindepth 1 -maxdepth 1 -exec rm -rf {} +
|
||||
git init -q .
|
||||
git fetch --depth 1 \
|
||||
"https://x-access-token:${TOKEN}@${GITEA_HOST}/${GITHUB_REPOSITORY}.git" \
|
||||
"$GITHUB_REF_NAME"
|
||||
git checkout -q FETCH_HEAD
|
||||
|
||||
- name: Install Quarto
|
||||
run: |
|
||||
set -e
|
||||
curl -sSL -o /tmp/quarto.tar.gz \
|
||||
"https://github.com/quarto-dev/quarto-cli/releases/download/v${QUARTO_VERSION}/quarto-${QUARTO_VERSION}-linux-amd64.tar.gz"
|
||||
mkdir -p "$HOME/opt"
|
||||
tar -xzf /tmp/quarto.tar.gz -C "$HOME/opt"
|
||||
echo "$HOME/opt/quarto-${QUARTO_VERSION}/bin" >> "$GITHUB_PATH"
|
||||
if [ ! -x "$HOME/opt/quarto-${QUARTO_VERSION}/bin/quarto" ]; then
|
||||
curl -sSL -o /tmp/quarto.tar.gz \
|
||||
"https://github.com/quarto-dev/quarto-cli/releases/download/v${QUARTO_VERSION}/quarto-${QUARTO_VERSION}-linux-amd64.tar.gz"
|
||||
mkdir -p "$HOME/opt"
|
||||
tar -xzf /tmp/quarto.tar.gz -C "$HOME/opt"
|
||||
rm -f /tmp/quarto.tar.gz
|
||||
fi
|
||||
|
||||
- name: Render
|
||||
run: quarto render
|
||||
run: "$HOME/opt/quarto-${QUARTO_VERSION}/bin/quarto render"
|
||||
|
||||
- name: Deploy to gh-pages
|
||||
env:
|
||||
TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||
run: |
|
||||
set -e
|
||||
REMOTE="https://x-access-token:${TOKEN}@gitea.spacilovi.eu/${GITHUB_REPOSITORY}.git"
|
||||
REMOTE="https://x-access-token:${TOKEN}@${GITEA_HOST}/${GITHUB_REPOSITORY}.git"
|
||||
WT="/tmp/gh-pages-${GITHUB_RUN_ID}"
|
||||
trap 'rm -rf "$WT"' EXIT
|
||||
|
||||
git config --global user.name "gitea-actions"
|
||||
git config --global user.email "gitea-actions@spacilovi.eu"
|
||||
git config user.name "gitea-actions"
|
||||
git config user.email "gitea-actions@spacilovi.eu"
|
||||
|
||||
# pracovní kopie gh-pages (zachová dosavadní historii větve)
|
||||
if git ls-remote --exit-code "$REMOTE" gh-pages >/dev/null 2>&1; then
|
||||
git fetch "$REMOTE" gh-pages
|
||||
git worktree add /tmp/gh-pages FETCH_HEAD
|
||||
cd /tmp/gh-pages
|
||||
git worktree add "$WT" FETCH_HEAD
|
||||
cd "$WT"
|
||||
git checkout -B gh-pages
|
||||
else
|
||||
mkdir -p /tmp/gh-pages
|
||||
cd /tmp/gh-pages
|
||||
mkdir -p "$WT"
|
||||
cd "$WT"
|
||||
git init -q -b gh-pages
|
||||
fi
|
||||
|
||||
|
||||
Reference in new issue
Block a user