Check hugo version #888
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: Check hugo version | |
on: | |
workflow_dispatch: | |
watch: | |
types: [started] # combined with if: github.actor line allows me to kick of builds with stars | |
schedule: | |
- cron: "0 0 * * *" | |
jobs: | |
action: | |
name: Checkout action-hugo | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout action-hugo | |
uses: actions/checkout@v4.1.1 | |
with: | |
path: action | |
token: ${{ secrets.PERSONAL_GITHUB_TOKEN }} | |
- name: Checkout hugo | |
uses: actions/checkout@v4.1.1 | |
with: | |
path: hugo | |
repository: gohugoio/hugo | |
submodules: true | |
fetch-depth: 0 | |
- name: Check version; Kick build | |
run: | | |
H_VERSION=$( | |
cd hugo | |
git fetch --all 1>&2 | |
git tag | sort -rV | head -n 1 | |
) | |
( | |
cd action | |
git fetch --all 1>&2 | |
for AV in $(git tag); do | |
echo "'${AV}' == '${H_VERSION}'" | |
if [ "${AV}" == "${H_VERSION}" ]; then | |
exit | |
fi | |
done | |
echo "${H_VERSION}" > BUILD_VERSION | |
git add BUILD_VERSION | |
git config --global user.email "github@utahcon.com" | |
git config --global user.name "Adam Barrett" | |
git push origin :refs/tags/build-${H_VERSION} || true | |
git push origin :build || true | |
git checkout -b build-${H_VERSION} | |
git commit -m "Build ${H_VERSION}" | |
git push origin build-${H_VERSION} --force | |
) |