This repository has been archived by the owner on Jul 3, 2024. It is now read-only.
chore(main): release 1.0.0 #1062
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: gh-pages-build | |
on: | |
workflow_dispatch: | |
push: | |
env: | |
# renovate: datasource=github-tags depName=gohugoio/hugo | |
HUGO_VERSION: 0.128.1 | |
permissions: | |
contents: write | |
jobs: | |
gh-pages-build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
deployments: write | |
steps: | |
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
with: | |
submodules: true | |
- name: Setup Hugo | |
uses: peaceiris/actions-hugo@75d2e84710de30f6ff7268e08f310b60ef14033f # v3.0.0 | |
with: | |
hugo-version: ${{ env.HUGO_VERSION }} | |
extended: true | |
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2 | |
with: | |
node-version: 18 | |
- name: Prepare public directory | |
run: | | |
set -euxo pipefail | |
mkdir public | |
cp LICENSE README.md public/ | |
- name: Set BASE_DOMAIN | |
id: base_domain | |
run: | | |
if [[ "${GITHUB_REF_NAME}" = "main" ]]; then | |
BASE_DOMAIN="${{ github.event.repository.name }}" | |
else | |
BASE_DOMAIN="$( echo ${{ github.event.repository.name }} | tr . - ).pages.dev" | |
fi | |
echo "BASE_DOMAIN=${BASE_DOMAIN}" | tee -a "${GITHUB_OUTPUT}" | |
- name: Copy posts to blog directories | |
run: | | |
set -euxo pipefail | |
mkdir -p {hugo-blowfish,hugo-loveit}/content jekyll-chirpy/_posts | |
cp -r my-test-posts/* hugo-blowfish/content/ | |
cp -r my-test-posts/* hugo-loveit/content/ | |
cp -r my-test-posts/* jekyll-chirpy/_posts/ | |
cp -r my-test-posts/posts/* docosaurus-test/blog/ | |
- name: Setup Ruby | |
uses: ruby/setup-ruby@1d0e911f615a112e322369596f10ee0b95b010ae # v1.183.0 | |
with: | |
ruby-version: 3.1 | |
bundler-cache: true | |
working-directory: jekyll-chirpy | |
- name: Build site | |
run: | | |
set -euxo pipefail | |
cd jekyll-chirpy | |
bundle exec jekyll build --destination ../public/jekyll-chirpy --baseurl /jekyll-chirpy/ | |
env: | |
JEKYLL_ENV: "production" | |
- name: Build Docosaurus | |
run: | | |
set -euxo pipefail | |
sed -i 's/${{ github.event.repository.name }}/${{ steps.base_domain.outputs.BASE_DOMAIN }}/' docosaurus-test/docusaurus.config.js | |
npm --prefix docosaurus-test install | |
npm --prefix docosaurus-test run build -- --out-dir ../public/docosaurus-test | |
- name: Build hugo pages | |
run: | | |
set -euxo pipefail | |
# Change links inside config.toml | |
sed -i "s/${{ github.event.repository.name }}/${{ steps.base_domain.outputs.BASE_DOMAIN }}/" config.toml | |
hugo --gc --destination public | |
cd hugo-blowfish | |
# Not working ... | |
# hugo --gc --baseURL "https://${{ steps.base_domain.outputs.BASE_DOMAIN }}/hugo-blowfish" --destination ../public/hugo-blowfish | |
cd ../hugo-loveit | |
hugo --gc --baseURL "https://${{ steps.base_domain.outputs.BASE_DOMAIN }}/hugo-loveit" --destination ../public/hugo-loveit | |
# - name: Check broken links | |
# uses: ruzickap/action-my-broken-link-checker@v2 | |
# with: | |
# url: https://${{ steps.base_domain.outputs.BASE_DOMAIN }} | |
# pages_path: ./public | |
# cmd_params: '--exclude=(linkedin.com) --buffer-size=8192 --max-connections-per-host=5 --color=always --rate-limit=5 --header="User-Agent:curl/7.54.0" --skip-tls-verification' | |
- name: Publish to GitHub Pages | |
uses: peaceiris/actions-gh-pages@4f9cc6602d3f66b9c108549d475ec49e8ef4d45e # v4.0.0 | |
if: ${{ github.ref == 'refs/heads/main' }} | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./public | |
force_orphan: true | |
cname: ${{ github.event.repository.name }} | |
- name: Web Page | |
run: | | |
cat << EOF | tee -a "${GITHUB_STEP_SUMMARY}" | |
* :low_brightness: <https://${{ steps.base_domain.outputs.BASE_DOMAIN }}> | |
EOF | |
- name: Publish to Cloudflare Pages | |
uses: cloudflare/pages-action@f0a1cd58cd66095dee69bfa18fa5efd1dde93bca # v1.5.0 | |
if: ${{ github.ref != 'refs/heads/main' && github.ref != 'refs/heads/gh-pages' }} | |
with: | |
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
branch: main | |
directory: ./public | |
gitHubToken: ${{ secrets.GITHUB_TOKEN }} | |
projectName: blog-test-ruzicka-dev |