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:
|
env:
|
||||||
QUARTO_VERSION: "1.10.18"
|
QUARTO_VERSION: "1.10.18"
|
||||||
|
GITEA_HOST: gitea.spacilovi.eu
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-deploy:
|
build-deploy:
|
||||||
|
# runner běží v host módu bez Node.js, proto žádné JS akce (actions/checkout apod.)
|
||||||
runs-on: homelab
|
runs-on: homelab
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- 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
|
- name: Install Quarto
|
||||||
run: |
|
run: |
|
||||||
set -e
|
set -e
|
||||||
curl -sSL -o /tmp/quarto.tar.gz \
|
if [ ! -x "$HOME/opt/quarto-${QUARTO_VERSION}/bin/quarto" ]; then
|
||||||
"https://github.com/quarto-dev/quarto-cli/releases/download/v${QUARTO_VERSION}/quarto-${QUARTO_VERSION}-linux-amd64.tar.gz"
|
curl -sSL -o /tmp/quarto.tar.gz \
|
||||||
mkdir -p "$HOME/opt"
|
"https://github.com/quarto-dev/quarto-cli/releases/download/v${QUARTO_VERSION}/quarto-${QUARTO_VERSION}-linux-amd64.tar.gz"
|
||||||
tar -xzf /tmp/quarto.tar.gz -C "$HOME/opt"
|
mkdir -p "$HOME/opt"
|
||||||
echo "$HOME/opt/quarto-${QUARTO_VERSION}/bin" >> "$GITHUB_PATH"
|
tar -xzf /tmp/quarto.tar.gz -C "$HOME/opt"
|
||||||
|
rm -f /tmp/quarto.tar.gz
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Render
|
- name: Render
|
||||||
run: quarto render
|
run: "$HOME/opt/quarto-${QUARTO_VERSION}/bin/quarto render"
|
||||||
|
|
||||||
- name: Deploy to gh-pages
|
- name: Deploy to gh-pages
|
||||||
env:
|
env:
|
||||||
TOKEN: ${{ secrets.GITEA_TOKEN }}
|
TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
set -e
|
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 user.name "gitea-actions"
|
||||||
git config --global user.email "gitea-actions@spacilovi.eu"
|
git config user.email "gitea-actions@spacilovi.eu"
|
||||||
|
|
||||||
# pracovní kopie gh-pages (zachová dosavadní historii větve)
|
# pracovní kopie gh-pages (zachová dosavadní historii větve)
|
||||||
if git ls-remote --exit-code "$REMOTE" gh-pages >/dev/null 2>&1; then
|
if git ls-remote --exit-code "$REMOTE" gh-pages >/dev/null 2>&1; then
|
||||||
git fetch "$REMOTE" gh-pages
|
git fetch "$REMOTE" gh-pages
|
||||||
git worktree add /tmp/gh-pages FETCH_HEAD
|
git worktree add "$WT" FETCH_HEAD
|
||||||
cd /tmp/gh-pages
|
cd "$WT"
|
||||||
git checkout -B gh-pages
|
git checkout -B gh-pages
|
||||||
else
|
else
|
||||||
mkdir -p /tmp/gh-pages
|
mkdir -p "$WT"
|
||||||
cd /tmp/gh-pages
|
cd "$WT"
|
||||||
git init -q -b gh-pages
|
git init -q -b gh-pages
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user