Build v0.123.7 #483
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: 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: | | |
echo "Github Ref: ${{ github.ref }}" | |
VERSION=${{ github.ref }} | |
echo "::set-output name=version::${VERSION#*-}" | |
hugo: | |
name: Checkout and build Hugo | |
runs-on: ubuntu-latest | |
needs: version | |
steps: | |
- uses: actions/setup-go@v5 | |
with: | |
go-version: '1.22' | |
- name: Checkout hugo | |
uses: actions/checkout@v4.1.1 | |
with: | |
path: hugodir | |
repository: gohugoio/hugo | |
submodules: true | |
fetch-depth: 0 | |
- name: Build hugo | |
run: | | |
go version | |
( | |
cd hugodir | |
git fetch --all | |
git tag | sort -V > hugo_versions | |
git checkout ${{ needs.version.outputs.version }} | |
go install --tags extended | |
) | |
mv $HOME/go/bin/hugo . | |
mv hugodir/hugo_versions . | |
- uses: actions/upload-artifact@v4.3.1 | |
with: | |
name: hugo | |
path: hugo | |
- uses: actions/upload-artifact@v4.3.1 | |
with: | |
name: hugo_versions | |
path: hugo_versions | |
action: | |
name: Checkout action-hugo | |
runs-on: ubuntu-latest | |
needs: hugo | |
steps: | |
- name: Checkout action-hugo | |
uses: actions/checkout@v4.1.1 | |
- name: Fetch all | |
run: git fetch --all | |
- name: Remove conflicting tags | |
run: | | |
for T in $(git tag); do | |
if [ "${T}" == "${{ needs.version.outputs.version }}" ]; then | |
git push origin :refs/tags/${{ needs.version.outputs.version }} | |
fi | |
done | |
- name: Remove conflicting branches | |
run: | | |
for B in $(git branch -r); do | |
if [ "${B}" == "origin/release-${{ needs.version.outputs.version }}" ]; then | |
git push origin :release-${{ needs.version.outputs.version }} | |
fi | |
done | |
build_and_push_container: | |
name: Build and push action-hugo container | |
runs-on: ubuntu-latest | |
needs: | |
- hugo | |
- version | |
- action | |
steps: | |
- uses: actions/checkout@v4.1.1 | |
with: | |
token: ${{ secrets.PERSONAL_GITHUB_TOKEN }} | |
- uses: actions/download-artifact@v5 | |
with: | |
name: hugo | |
path: . | |
- uses: actions/download-artifact@v4.1.4 | |
with: | |
name: hugo_versions | |
path: . | |
- run: 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-${{ needs.version.outputs.version }} | |
- name: chmod hugo | |
run: chmod +x hugo | |
- name: Run hugo-scraper | |
run: ./hugo-scraper.sh | |
- 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 ${{ needs.version.outputs.version }}" | |
- name: Create version tag | |
run: git tag -af ${{ needs.version.outputs.version }} -m "Version ${{ needs.version.outputs.version }}" | |
- name: Check latest tagging | |
run: | | |
HUGO_VERSION=$(curl https://api.github.com/repos/gohugoio/hugo/tags | jq -r .[0].name) | |
VERSION=${{ needs.version.outputs.version }} | |
if [ ${VERSION} == ${HUGO_VERSION} ]; then | |
git tag -af latest -m "Version ${{ needs.version.outputs.version }}" | |
fi | |
- uses: docker/build-push-action@v5.1.0 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_TOKEN }} | |
repository: utahcon/hugo | |
dockerfile: Containerfile | |
tags: ${{ needs.version.outputs.version }} | |
- name: Push release branch and tags | |
run: git push origin release-${{ needs.version.outputs.version }} --tags --force |