Compare commits
No commits in common. "81e5a18460a121c7516bb3d4f7c8cf2c0dcf52bd" and "cf31d448f8ae6e7c54e0776040ff3bf761426e6c" have entirely different histories.
81e5a18460
...
cf31d448f8
140
.github/workflows/hugo.yml
vendored
140
.github/workflows/hugo.yml
vendored
@ -1,140 +0,0 @@
|
|||||||
# Sample workflow for building and deploying a Hugo site to GitHub Pages
|
|
||||||
name: Deploy Hugo site to Pages
|
|
||||||
|
|
||||||
on:
|
|
||||||
# Runs on pushes targeting the default branch
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
|
|
||||||
# Runs on pull requests
|
|
||||||
pull_request:
|
|
||||||
|
|
||||||
# Allows you to run this workflow manually from the Actions tab
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
pages: write
|
|
||||||
id-token: write
|
|
||||||
|
|
||||||
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
|
|
||||||
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
|
|
||||||
concurrency:
|
|
||||||
group: "pages"
|
|
||||||
cancel-in-progress: false
|
|
||||||
|
|
||||||
# Default to bash
|
|
||||||
defaults:
|
|
||||||
run:
|
|
||||||
# GitHub-hosted runners automatically enable `set -eo pipefail` for Bash shells.
|
|
||||||
shell: bash
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
# Build job
|
|
||||||
build:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
env:
|
|
||||||
HUGO_VERSION: 0.148.0
|
|
||||||
HUGO_ENVIRONMENT: production
|
|
||||||
TZ: America/New_York
|
|
||||||
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
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
with:
|
|
||||||
submodules: recursive
|
|
||||||
fetch-depth: 0
|
|
||||||
- name: Setup Pages
|
|
||||||
id: pages
|
|
||||||
uses: actions/configure-pages@v5
|
|
||||||
- name: Cache Restore
|
|
||||||
id: cache-restore
|
|
||||||
uses: actions/cache/restore@v4
|
|
||||||
with:
|
|
||||||
path: |
|
|
||||||
${{ runner.temp }}/hugo_cache
|
|
||||||
key: hugo-${{ github.run_id }}
|
|
||||||
restore-keys:
|
|
||||||
hugo-
|
|
||||||
- name: Configure Git
|
|
||||||
run: git config core.quotepath false
|
|
||||||
- name: Build with Hugo
|
|
||||||
run: |
|
|
||||||
hugo \
|
|
||||||
--gc \
|
|
||||||
--minify \
|
|
||||||
--baseURL "${{ steps.pages.outputs.base_url }}/" \
|
|
||||||
--cacheDir "${{ runner.temp }}/hugo_cache"
|
|
||||||
- name: Create CNAME file
|
|
||||||
run: |
|
|
||||||
cat << EOF > public/CNAME
|
|
||||||
neilhanlon.me
|
|
||||||
neilhanlon.com
|
|
||||||
hanlon.ninja
|
|
||||||
thepotato.tech
|
|
||||||
EOF
|
|
||||||
- name: Cache Save
|
|
||||||
id: cache-save
|
|
||||||
uses: actions/cache/save@v4
|
|
||||||
with:
|
|
||||||
path: |
|
|
||||||
${{ runner.temp }}/hugo_cache
|
|
||||||
key: ${{ steps.cache-restore.outputs.cache-primary-key }}
|
|
||||||
- name: Upload artifact
|
|
||||||
uses: actions/upload-pages-artifact@v3
|
|
||||||
with:
|
|
||||||
path: ./public
|
|
||||||
|
|
||||||
# Deployment job
|
|
||||||
deploy:
|
|
||||||
if: github.ref == 'refs/heads/main'
|
|
||||||
environment:
|
|
||||||
name: github-pages
|
|
||||||
url: ${{ steps.deployment.outputs.page_url }}
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs: build
|
|
||||||
steps:
|
|
||||||
- name: Deploy to GitHub Pages
|
|
||||||
id: deployment
|
|
||||||
uses: actions/deploy-pages@v4
|
|
||||||
|
|
||||||
# PR Preview job
|
|
||||||
preview:
|
|
||||||
if: github.event_name == 'pull_request'
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
needs: build
|
|
||||||
steps:
|
|
||||||
- name: Download artifact
|
|
||||||
uses: actions/download-artifact@v4
|
|
||||||
with:
|
|
||||||
name: github-pages
|
|
||||||
path: ./preview
|
|
||||||
- name: Extract site
|
|
||||||
run: |
|
|
||||||
cd preview
|
|
||||||
tar -xf artifact.tar
|
|
||||||
- name: Install surge
|
|
||||||
run: npm install -g surge
|
|
||||||
- name: Deploy to surge.sh
|
|
||||||
run: |
|
|
||||||
export SURGE_DOMAIN="thepotato-tech-pr-${{ github.event.number }}.surge.sh"
|
|
||||||
surge ./preview --domain $SURGE_DOMAIN --token ${{ secrets.SURGE_TOKEN }}
|
|
||||||
echo "Preview URL: https://$SURGE_DOMAIN" >> $GITHUB_STEP_SUMMARY
|
|
||||||
- name: Comment PR
|
|
||||||
uses: actions/github-script@v7
|
|
||||||
with:
|
|
||||||
script: |
|
|
||||||
const domain = `thepotato-tech-pr-${{ github.event.number }}.surge.sh`;
|
|
||||||
github.rest.issues.createComment({
|
|
||||||
issue_number: context.issue.number,
|
|
||||||
owner: context.repo.owner,
|
|
||||||
repo: context.repo.repo,
|
|
||||||
body: `🚀 Preview deployed to: https://${domain}`
|
|
||||||
});
|
|
13
.gitlab-ci.yml
Normal file
13
.gitlab-ci.yml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
image: registry.gitlab.com/pages/hugo/hugo_extended:latest
|
||||||
|
|
||||||
|
variables:
|
||||||
|
GIT_SUBMODULE_STRATEGY: recursive
|
||||||
|
|
||||||
|
pages:
|
||||||
|
script:
|
||||||
|
- hugo
|
||||||
|
artifacts:
|
||||||
|
paths:
|
||||||
|
- public
|
||||||
|
only:
|
||||||
|
- main
|
57
.woodpecker.yml
Normal file
57
.woodpecker.yml
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
---
|
||||||
|
branches: main
|
||||||
|
|
||||||
|
variables:
|
||||||
|
surge_settings: &surge_settings
|
||||||
|
path: public
|
||||||
|
surge_token:
|
||||||
|
from_secret: SURGE_TOKEN
|
||||||
|
forge_type: gitea
|
||||||
|
forge_url: https://git.shrug.pw
|
||||||
|
forge_repo_token:
|
||||||
|
from_secret: SURGE_GITEA
|
||||||
|
|
||||||
|
clone:
|
||||||
|
git:
|
||||||
|
image: woodpeckerci/plugin-git
|
||||||
|
settings:
|
||||||
|
recursive: true
|
||||||
|
|
||||||
|
pipeline:
|
||||||
|
build:
|
||||||
|
image: registry.gitlab.com/pages/hugo/hugo_extended:latest
|
||||||
|
commands:
|
||||||
|
- hugo
|
||||||
|
|
||||||
|
preview:
|
||||||
|
image: woodpeckerci/plugin-surge-preview
|
||||||
|
secrets: [SURGE_TOKEN, SURGE_GITEA]
|
||||||
|
settings: *surge_settings
|
||||||
|
when:
|
||||||
|
event: pull_request
|
||||||
|
|
||||||
|
teardown-preview:
|
||||||
|
image: woodpeckerci/plugin-surge-preview
|
||||||
|
secrets: [SURGE_TOKEN, SURGE_GITEA]
|
||||||
|
settings: *surge_settings
|
||||||
|
environment:
|
||||||
|
- CI_BUILD_EVENT=pull_close
|
||||||
|
when:
|
||||||
|
event: pull_close
|
||||||
|
|
||||||
|
publish:
|
||||||
|
image: git.shrug.pw/neil/containers/woodpecker-ci:latest
|
||||||
|
secrets: [ssh_key, GITLAB_DEPLOY_TOKEN]
|
||||||
|
environment:
|
||||||
|
- GIT_AUTHOR_NAME="Woody the Woodpecker"
|
||||||
|
- GIT_AUTHOR_EMAIL=ci@shrug.pw
|
||||||
|
commands:
|
||||||
|
- mkdir -p ~/.ssh/
|
||||||
|
- echo "$SSH_KEY" > ~/.ssh/id_rsa
|
||||||
|
- chmod 0700 ~/.ssh/
|
||||||
|
- chmod 0600 ~/.ssh/id_rsa
|
||||||
|
- bash deploy.sh
|
||||||
|
when:
|
||||||
|
branch: main
|
||||||
|
event: [push]
|
||||||
|
|
37
deploy.sh
Normal file
37
deploy.sh
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
#!/bin/bash -ex
|
||||||
|
|
||||||
|
export GIT_AUTHOR_NAME="${GIT_AUTHOR_NAME}"
|
||||||
|
export GIT_AUTHOR_EMAIL="${GIT_AUTHOR_EMAIL}"
|
||||||
|
export GIT_SSH_COMMAND="ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no"
|
||||||
|
|
||||||
|
REMOTE="${PUSH_REMOTE:-git@git.shrug.pw:neil/neilhanlon.me.git}"
|
||||||
|
|
||||||
|
rm -fr pages.git
|
||||||
|
mkdir pages.git
|
||||||
|
|
||||||
|
( cd pages.git && git init -b pages )
|
||||||
|
rsync -av public/* pages.git
|
||||||
|
|
||||||
|
cat << EOF > pages.git/.domains
|
||||||
|
neilhanlon.me
|
||||||
|
neilhanlon.com
|
||||||
|
hanlon.ninja
|
||||||
|
thepotato.tech
|
||||||
|
EOF
|
||||||
|
|
||||||
|
cp .woodpecker.yml pages.git/
|
||||||
|
|
||||||
|
cd pages.git
|
||||||
|
|
||||||
|
set -x
|
||||||
|
git config user.name "$GIT_AUTHOR_NAME"
|
||||||
|
git config user.email "$GIT_AUTHOR_EMAIL"
|
||||||
|
git add -A
|
||||||
|
git commit -m "Deployment at $(date -u -Is)"
|
||||||
|
git remote add origin $REMOTE
|
||||||
|
git push -f origin pages
|
||||||
|
|
||||||
|
curl -X POST --fail \
|
||||||
|
-F token=$GITLAB_DEPLOY_TOKEN \
|
||||||
|
-F ref=main \
|
||||||
|
https://gitlab.com/api/v4/projects/29559707/trigger/pipeline
|
Loading…
x
Reference in New Issue
Block a user