-
Notifications
You must be signed in to change notification settings - Fork 0
43 lines (38 loc) · 1.55 KB
/
sync-version.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
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