deploy no artifact gh action
·
4 mins read
·
edit
newest-version
name: Deploy Hugo site from private repo to public repo
on:
push:
tags:
- "deploy-*"
workflow_dispatch:
permissions:
contents: write
defaults:
run:
shell: bash
jobs:
build-and-deploy:
runs-on: ubuntu-latest
env:
HUGO_VERSION: 0.146.4
REPO_NAME: butiran
steps:
- name: Install Hugo CLI
run: |
wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb
sudo dpkg -i ${{ runner.temp }}/hugo.deb
- name: Install Dart Sass
run: sudo snap install dart-sass
- name: Checkout private source repo
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Node.js dependencies
run: "[[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci || true"
- name: Build with Hugo
env:
HUGO_CACHEDIR: ${{ runner.temp }}/hugo_cache
HUGO_ENVIRONMENT: production
run: |
BASE_URL="https://${{ github.repository_owner }}.github.io/${REPO_NAME}/"
hugo --minify --baseURL "$BASE_URL"
- name: Clone public Pages butiran
run: |
#git clone https://${{ secrets.REPO_DEPLOY_SECRET }}@github.com/username/reponame.git deploy_repo
#git clone --branch main https://${{ secrets.REPO_DEPLOY_SECRET }}@github.com/username/reponame.git deploy_repo
#git clone https://x-access-token:${{ secrets.REPO_DEPLOY_SECRET }}@github.com/username/reponame.git deploy_repo
#echo "Token length: ${#GITHUB_TOKEN}"
#git clone https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/username/reponame.git deploy_repo
git clone https://x-access-token:${{ github.token }}@github.com/usename/reponame.git deploy_repo
- name: Deploy site
run: |
cd deploy_repo
mkdir -p docs
rm -rf docs/*
#cp -r ../public/* docs/
#rsync -av --delete ../public/ docs/
#rsync -av --delete \
rsync -a --delete \
--info=progress2 \
--no-owner \
--no-group \
--chmod=Du=rwx,Dgo=rx,Fu=rw,Fgo=r \
--ignore-errors \
../public/ docs/
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add docs
#git commit -m "Deploy Hugo site" || echo "No changes to commit"
#git push
if git diff --cached --quiet; then
echo "No changes to deploy"
exit 0
fi
git commit -m "Deploy Hugo site"
git push --verbose
newer-version
name: Deploy Hugo site from private repo to public repo
on:
push:
tags:
- "deploy-*"
workflow_dispatch:
permissions:
contents: write
defaults:
run:
shell: bash
jobs:
build-and-deploy:
runs-on: ubuntu-latest
env:
HUGO_VERSION: 0.146.4
REPO_NAME: butiran
steps:
- name: Install Hugo CLI
run: |
wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb
sudo dpkg -i ${{ runner.temp }}/hugo.deb
- name: Install Dart Sass
run: sudo snap install dart-sass
- name: Checkout private source repo
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Node.js dependencies
run: "[[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci || true"
- name: Build with Hugo
env:
HUGO_CACHEDIR: ${{ runner.temp }}/hugo_cache
HUGO_ENVIRONMENT: production
run: |
BASE_URL="https://${{ github.repository_owner }}.github.io/${REPO_NAME}/"
hugo --minify --baseURL "$BASE_URL"
- name: Clone public Pages butiran
run: |
git clone https://${{ secrets.REPO_DEPLOY_SECRET }}@github.com/username/reponame.git deploy_repo
- name: Deploy site
run: |
cd deploy_repo
mkdir -p docs
rm -rf docs/*
cp -r ../public/* docs/
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add docs
git commit -m "Deploy Hugo site" || echo "No changes to commit"
git push
old-version
name: Deploy Hugo site to public "butiran" repo
on:
push:
tags:
- "deploy-*"
workflow_dispatch:
permissions:
contents: write
concurrency:
group: "pages"
cancel-in-progress: false
defaults:
run:
shell: bash
jobs:
build:
runs-on: ubuntu-latest
env:
HUGO_VERSION: 0.146.4
steps:
- name: Install Hugo CLI
run: |
wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb
- name: Install Dart Sass
run: sudo snap install dart-sass
- name: Checkout private source repo
uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Node.js dependencies
run: "[[ -f package-lock.json || -f npm-shrinkwrap.json ]] && npm ci || true"
- name: Build with Hugo
env:
HUGO_CACHEDIR: ${{ runner.temp }}/hugo_cache
HUGO_ENVIRONMENT: production
run: |
REPO_NAME="butiran"
BASE_URL="https://${{ github.repository_owner }}.github.io/${REPO_NAME}/"
hugo --minify --baseURL "$BASE_URL"
- name: Upload public folder as artifact
uses: actions/upload-artifact@v4
with:
name: site
path: public
deploy:
runs-on: ubuntu-latest
needs: build
steps:
- name: Download built site
uses: actions/download-artifact@v4
with:
name: site
path: public
- name: Clone public repo
run: |
git clone https://${{ secrets.BUTIRAN_DEPLOY_SECRET }}@github.com/username/reponame.git deploy_repo
cd deploy_repo
# Make sure public folder exists
mkdir -p public
mkdir -p docs
# Clean old build
rm -rf docs/*
# Copy new build into /public
cp -r ../public/* docs/
# Optional: keep README and LICENSE untouched
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add docs
git commit -m "Update Hugo site in /public" || echo "No changes to commit"
git push
notes
- Old version is as input for a discussion that gives new version as output 1.
- It still does not work even with newest version.
- It is postponed at 1838 on 21-dec-2025.
refs
GPT 5.2, “Artifact storage quota issue”, ChatGPT, 21 Dec 2025, url https://chatgpt.com/share/69474862-c034-800a-b244-6d33cfc2123f [20251221]. ↩︎