Skip to content

Build v0.142.0

Build v0.142.0 #562

Workflow file for this run

name: Build action-hugo
on:
workflow_dispatch:
push:
branches:
- build*
jobs:
version:
name: Get Build Version
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- id: version
run: |
VERSION=${{ github.ref }}
VERSION=${VERSION#*-}
VERSION=${VERSION#*v}
echo "version=${VERSION}" >> $GITHUB_OUTPUT
build_and_push_container:
name: Build and push action-hugo container
runs-on: ubuntu-latest
needs:
- version
steps:
- uses: actions/checkout@v4.1.1
with:
token: ${{ secrets.PERSONAL_GITHUB_TOKEN }}
- name: Fetch all
run: git fetch --all
- name: Remove conflicting tags/branches
run: |
for T in $(git tag); do if [ "${T}" == "${{ needs.version.outputs.version }}" ]; then git push origin :refs/tags/v${{ needs.version.outputs.version }}; fi; done
for B in $(git branch -r); do if [ "${B}" == "origin/release-${{ needs.version.outputs.version }}" ]; then git push origin :release-v${{ needs.version.outputs.version }}; fi; done
- name: Download Hugo binary
run: |
curl -L https://github.com/gohugoio/hugo/releases/download/v${{ needs.version.outputs.version }}/hugo_extended_${{ needs.version.outputs.version }}_linux-amd64.tar.gz --output hugo.tgz
tar xf hugo.tgz
chmod +x hugo
- name: Identify
run: |
git config --global user.email "github@utahcon.com"
git config --global user.name "Adam Barrett"
- name: Create and checkout release branch
run: git checkout -b release-v${{ needs.version.outputs.version }}
- name: Run hugo-scraper
run: ./hugo-scraper.sh ${{ needs.version.outputs.version }}
- name: chmod entrypoint
run: chmod +x entrypoint.sh
- name: commit action.yml entrypoint.sh and README.md
run: |
git add action.yml entrypoint.sh README.md
git commit -m "Documentation for v${{ needs.version.outputs.version }}"
- name: Create version tag
run: git tag -af v${{ needs.version.outputs.version }} -m "Version v${{ needs.version.outputs.version }}"
- name: List
run: tree
- name: Check latest tagging
run: |
HUGO_VERSION=$(curl https://api.github.com/repos/gohugoio/hugo/tags | jq -r .[0].name)
VERSION=v${{ needs.version.outputs.version }}
if [ ${VERSION} == ${HUGO_VERSION} ]; then
git tag -af latest -m "Version v${{ needs.version.outputs.version }}"
fi
- name: Set up Docker Build
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_TOKEN }}
- uses: docker/build-push-action@v5.1.0
with:
no-cache: true
file: Containerfile
context: .
tags: utahcon/hugo:v${{ needs.version.outputs.version }}
push: true
- name: Push release branch and tags
run: git push origin release-v${{ needs.version.outputs.version }} --tags --force