Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Actions to update Go version automatically. #51

Open
wants to merge 58 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
58 commits
Select commit Hold shift + click to select a range
1aeb3ef
update Go version by Actions
capric98 Mar 5, 2021
38b8f2d
misplaced
capric98 Mar 5, 2021
1e520f3
format
capric98 Mar 5, 2021
f63e237
rename
capric98 Mar 5, 2021
d5bf8a1
edit download url
capric98 Mar 5, 2021
4a73bbd
Update Go version by actions.
Mar 11, 2021
1aeee0f
Update daily-check.yml
capric98 Mar 11, 2021
8fb731e
fix: regex
capric98 Mar 12, 2021
e558aa8
fix regex
capric98 Mar 12, 2021
981db29
Update Go version by Actions.
Mar 12, 2021
2009b06
lightweight response
capric98 Mar 12, 2021
b007cac
Update Go version by Actions.
Apr 2, 2021
11aea42
Update Go version by Actions.
May 7, 2021
8c98739
Update Go version by Actions.
Jun 4, 2021
487334f
Update Go version by Actions.
Jul 13, 2021
7b69752
Update Go version by Actions.
Aug 6, 2021
e26dbf5
Update Go version by Actions.
Aug 17, 2021
35d3eeb
Update Go version by Actions.
Sep 10, 2021
1f11388
Update Go version by Actions.
Oct 8, 2021
2300b31
Update Go version by Actions.
Nov 5, 2021
5aab883
Update Go version by Actions.
Dec 3, 2021
e7be87f
Update Go version by Actions.
Dec 10, 2021
7f67790
Update Go version by Actions.
Jan 7, 2022
c469f99
Update Go version by Actions.
Feb 11, 2022
1e335dd
Update Go version by Actions.
Mar 4, 2022
42cec1e
Update Go version by Actions.
Mar 16, 2022
5ea7261
Update Go version by Actions.
Apr 13, 2022
e006c3d
Update Go version by Actions.
May 11, 2022
a6627dc
Update Go version by Actions.
Jun 2, 2022
5e387f8
Update Go version by Actions.
Jul 13, 2022
97b3d2a
Update Go version by Actions.
Aug 2, 2022
e8beb24
Update Go version by Actions.
Aug 3, 2022
eaf3d3c
Update Go version by Actions.
Sep 7, 2022
eadece7
Update Go version by Actions.
Oct 5, 2022
d7eff14
Update Go version by Actions.
Nov 2, 2022
f71176f
Update Go version by Actions.
Dec 7, 2022
0ac66a8
Update Go version by Actions.
Jan 11, 2023
4aed9af
Update Go version by Actions.
Feb 2, 2023
d8e0510
Update Go version by Actions.
Feb 15, 2023
08660f7
Update Go version by Actions.
Mar 8, 2023
717d420
Update Go version by Actions.
Apr 5, 2023
08f30f6
Update Go version by Actions.
May 3, 2023
a21ad34
Update Go version by Actions.
Jun 7, 2023
707fb12
Update Go version by Actions.
Jul 12, 2023
c2ba8c4
Update Go version by Actions.
Aug 2, 2023
c79167a
Update Go version by Actions.
Aug 9, 2023
da17a4d
Update Go version by Actions.
Sep 7, 2023
e986d1a
Update Go version by Actions.
Oct 6, 2023
11fe514
Update Go version by Actions.
Oct 11, 2023
9cdb0f2
Update Go version by Actions.
Nov 8, 2023
efb2dd5
Update Go version by Actions.
Dec 6, 2023
0b6ff7e
Update Go version by Actions.
Jan 10, 2024
d6c74e7
Update Go version by Actions.
Feb 7, 2024
d32ad05
Update Go version by Actions.
Mar 6, 2024
f33d640
Update Go version by Actions.
Apr 4, 2024
0aab94b
Update Go version by Actions.
May 8, 2024
651c5f8
Update Go version by Actions.
Jun 5, 2024
9c513b6
Update Go version by Actions.
Jul 3, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .github/workflows/daily-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Go Version

on:
push:
schedule:
- cron: '0 0 * * *'

jobs:
check:

runs-on: ubuntu-latest

steps:
- name: Checkout Actions
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.9

- name: Install Dependencies
run: python -m pip install --upgrade requests

- name: Check Version
#env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
VERSION=`python tests/version.py`
echo Latest: ${VERSION}
sed -i "s/VERSION=\".*\?\"/VERSION=\"${VERSION}\"/g" goinstall.sh
if [ -n "$(git status --porcelain)" ]; then
git config --global user.name 'Actions'
git config --global user.email 'Actions@users.noreply.github.com'
git commit -am "Update Go version by Actions."
git push
fi
6 changes: 3 additions & 3 deletions goinstall.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# shellcheck disable=SC2016
set -e

VERSION="1.16"
VERSION="1.22.5"

[ -z "$GOROOT" ] && GOROOT="$HOME/.go"
[ -z "$GOPATH" ] && GOPATH="$HOME/go"
Expand Down Expand Up @@ -116,9 +116,9 @@ TEMP_DIRECTORY=$(mktemp -d)

echo "Downloading $PACKAGE_NAME ..."
if hash wget 2>/dev/null; then
wget https://storage.googleapis.com/golang/$PACKAGE_NAME -O "$TEMP_DIRECTORY/go.tar.gz"
wget https://dl.google.com/go/$PACKAGE_NAME -O "$TEMP_DIRECTORY/go.tar.gz"
else
curl -o "$TEMP_DIRECTORY/go.tar.gz" https://storage.googleapis.com/golang/$PACKAGE_NAME
curl -o "$TEMP_DIRECTORY/go.tar.gz" https://dl.google.com/go/$PACKAGE_NAME
fi

if [ $? -ne 0 ]; then
Expand Down
7 changes: 7 additions & 0 deletions tests/version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/usr/bin/env python3
#coding=utf-8
import requests
import re

resp = requests.get("https://golang.org/dl/?mode=json").text
print(re.findall("(?<=go)[.,0-9]+(?=.src.tar.gz)", resp)[0], end="")