Skip to content

sync-version

sync-version #147

Workflow file for this run

name: sync-version
on:
push:
branches:
- master
schedule:
# We specifically set this following Simple Icon's GitHub workflow schedule:
# 10 hours after release.
- cron: '0 23 * * 3' # 23:00 at every Wednesday
jobs:
sync:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- uses: cachix/install-nix-action@v16
with:
nix_path: nixpkgs=channel:nixos-unstable
- name: Update Hugo module
run: |
nix-shell --run 'make update'
- name: Commit and tag
run: |
# Get the Simple Icons version to be synced with.
simple_icon_version=$(nix-shell --run "curl --retry 10 --silent https://api.github.com/repos/simple-icons/simple-icons/releases/latest | jq --raw-output '.tag_name'")
echo "Simple Icon version: ${simple_icon_version}"
# Show the commit as set by the Actions bot.
# https://github.com/actions/checkout/discussions/479
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
# Commit the update.
git add go.mod go.sum
git commit --message "Sync to Simple Icons v${simple_icon_version}"
# Add the tag.
git tag "v${simple_icon_version}"
# Push it into the current branch.
git remote remove origin
git remote add origin https://${{ secrets.GITHUB_TOKEN }}@github.com/foo-dogsquared/hugo-mod-simple-icons.git
git push --set-upstream origin master --tags