Skip to content

Commit

Permalink
Merge pull request #157 from deining/gh-action
Browse files Browse the repository at this point in the history
  • Loading branch information
StefMa authored Feb 28, 2023
2 parents b43789a + 380533f commit b295365
Show file tree
Hide file tree
Showing 12 changed files with 177 additions and 99 deletions.
94 changes: 0 additions & 94 deletions .circleci/config.yml

This file was deleted.

6 changes: 3 additions & 3 deletions .github/workflows/docs-to-gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: '0.58.3'
hugo-version: '0.110.0'
extended: true

- name: Build
run: hugo --minify
working-directory: docs
run: hugo --minify

- name: Deploy
uses: peaceiris/actions-gh-pages@v3
Expand Down
41 changes: 41 additions & 0 deletions .github/workflows/fresh-to-vercel-pr-deployment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Fresh to vercel PR deployment

on:
workflow_run:
workflows: [Fresh to vercel PR]
types:
- completed

jobs:
createExampleAndDeployToArtifacts:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Download hugo build
uses: actions/download-artifact@v3
with:
name: hugo-output
path: public/

- name: Download alias-domain
uses: actions/download-artifact@v3
with:
name: alias-domain
path: alias-domain

- name: Extract alias-domain
id: extract-alias-domain
run: |
aliasDomain=`cat alias-domain/alias-domain`
echo "ALIAS_DOMAIN=$aliasDomain" >> $GITHUB_OUTPUT
- name: Deploy to Vercel on PR
uses: amondnet/vercel-action@v25
with:
vercel-token: ${{ secrets.VERCEL_TOKEN }}
vercel-org-id: ${{ secrets.VERCEL_ORG_ID}}
vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID}}
alias-domains: ${{ steps.extract-alias-domain.outputs.ALIAS_DOMAIN }}"
working-directory: ./public
46 changes: 46 additions & 0 deletions .github/workflows/fresh-to-vercel-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Fresh to vercel PR

on:
pull_request:

jobs:
createExampleAndDeployToArtifacts:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: '0.110.0'
extended: true

- name: Build with Hugo on PR
working-directory: exampleSite
run: |
git clone https://github.com/StefMa/hugo-fresh themes/hugo-fresh
cd themes/hugo-fresh
git fetch origin ${{ github.ref }}:pr-branch-name
git checkout pr-branch-name
cd ../..
hugo \
--minify \
--baseURL https://hugo-fresh-${{ github.run_number }}.vercel.app
- name: Save hugo as artifact
uses: actions/upload-artifact@v3
with:
name: hugo-output
path: exampleSite/public/

- name: Save alias domain
run: |
mkdir -p ./alias-domain
echo https://hugo-fresh-${{ github.run_number }}.vercel.app > ./alias-domain/alias-domain
- name: Save alias domain as artifact
uses: actions/upload-artifact@v3
with:
name: alias-domain
path: alias-domain/
36 changes: 36 additions & 0 deletions .github/workflows/fresh-to-vercel.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: Fresh to vercel

on:
push:
branches:
- master

jobs:
deployMasterToVercel:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: '0.110.0'
extended: true

- name: Build with Hugo on master
working-directory: exampleSite
run: |
git clone https://github.com/StefMa/hugo-fresh themes/hugo-fresh
hugo \
--minify \
--baseURL https://hugo-fresh.vercel.app/
- name: Deploy to Vercel on master
uses: amondnet/vercel-action@v25
with:
vercel-token: ${{ secrets.VERCEL_TOKEN }}
vercel-org-id: ${{ secrets.VERCEL_ORG_ID}}
vercel-project-id: ${{ secrets.VERCEL_PROJECT_ID}}
vercel-args: '--prod'
working-directory: ./exampleSite/public
47 changes: 47 additions & 0 deletions .github/workflows/htmltest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# .github/workflows/htmltest.yml
# Run htmltest link checker on generated HTML output from user guide

name: Link check with htmltest

on:
workflow_dispatch:
push:
branches:
- main
pull_request:

jobs:
htmltest:
runs-on: ubuntu-latest
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
steps:
- name: Check out repository
uses: actions/checkout@v3
with:
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod

- name: Set up Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: "latest"
extended: true

- run: hugo --destination $GITHUB_WORKSPACE/exampleSite/public --themesDir ../../ --theme hugo-fresh
working-directory: exampleSite

- name: Test HTML
# https://github.com/wjdp/htmltest-action/
continue-on-error: true # <- Set to true if run shouldn't fail with broken links
uses: wjdp/htmltest-action@master
with:
# For consistency, use the same config file as for local builds
config: exampleSite/.htmltest.yml
path: exampleSite/public

- name: Archive htmltest results
uses: actions/upload-artifact@v3
with:
name: htmltest-report
path: tmp/.htmltest/htmltest.log
retention-days: 7 # default is 90 days
2 changes: 1 addition & 1 deletion docs/content/getstarted.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ git clone https://github.com/StefMa/hugo-fresh themes/hugo-fresh
rm config.toml

# Fetch the example config
curl -O https://raw.githubusercontent.com/StefMa/hugo-fresh/master/exampleSite/config.yaml
curl -O https://raw.githubusercontent.com/StefMa/hugo-fresh/master/exampleSite/hugo.yaml

# Run the site locally
hugo server
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions exampleSite/.htmltest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
DirectoryPath: public
File renamed without changes.
1 change: 1 addition & 0 deletions layouts/_default/list.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{{ "<!-- Layout with no content to avoid WARN message about missing page layout -->" | safeHTML }}
2 changes: 1 addition & 1 deletion layouts/partials/section5.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ <h3 class="subtitle is-5 is-muted">{{ $subtitle }}</h3>
<input class="input is-medium" name="email" type="email" placeholder="Enter your email address">
</div>
<div class="column is-12">
<textarea class="textarea" name="message" rows="10" placeholder="Write someting..."></textarea>
<textarea class="textarea" name="message" rows="10" placeholder="Write something..."></textarea>
</div>
<div class="form-footer has-text-centered mt-10">
<button class="button cta is-large primary-btn raised is-clear">{{ $buttonText }}</button>
Expand Down

0 comments on commit b295365

Please sign in to comment.