Bump #4597
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: Bump | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "25 1-23/8 * * *" | |
push: | |
branches: | |
- master | |
paths-ignore: | |
- "**/LICENSE" | |
- "**/README.md" | |
- "**/getting_start.sh" | |
- "**/alpine_getting_start.sh" | |
- "**/void_getting_start.sh" | |
# pull_request: | |
# branches: | |
# - master | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
# This workflow contains a single job called "Bump" | |
Bump: | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Set some variables | |
run: | | |
set -x | |
GITHUB_API_BASEURL='https://api.github.com' | |
TMP_FILE=$(mktemp) | |
if curl -sS -i -I -H "Accept: application/vnd.github.v3+json" -o "$TMP_FILE" -- 'https://github-cache.yingmale.win/api/'; then | |
HTTP_STATUS_CODE=$(awk 'NR==1 {print $2}' "$TMP_FILE") | |
if [[ $HTTP_STATUS_CODE -ge 200 ]] && [[ $HTTP_STATUS_CODE -le 299 ]]; then | |
GITHUB_API_BASEURL='https://github-cache.yingmale.win/api' | |
echo "info: github cache is ready, will use ${GITHUB_API_BASEURL} as GITHUB_API_BASEURL." | |
fi | |
fi | |
"rm" -f "$TMP_FILE" | |
echo "GITHUB_API_BASEURL=${GITHUB_API_BASEURL}" >> $GITHUB_ENV | |
echo "RELEASE_NAME=$(date +%Y%m%d%H%M%S)" >> $GITHUB_ENV | |
echo "TAG_NAME=$(date +%Y%m%d%H%M%S)" >> $GITHUB_ENV | |
echo "REPO_URL=github.com/${{ github.repository }}" >> $GITHUB_ENV | |
echo "checksec_latest_tag_name=$(curl -sSL --fail --retry 5 --retry-delay 10 --retry-max-time 60 -H 'Accept: application/vnd.github.v3+json' \ | |
"${GITHUB_API_BASEURL}/repos/slimm609/checksec.sh/releases/latest" | | |
grep -F 'tag_name' | cut -d'"' -f4)" >> $GITHUB_ENV | |
echo "bashrc_latest_commit_hash=$(curl -sL -H 'Accept: application/vnd.github.v3+json' \ | |
"${GITHUB_API_BASEURL}/repos/IceCodeNew/myrc/commits?per_page=1&path=.bashrc" | | |
grep -Fm1 'sha' | cut -d'"' -f4)" >> $GITHUB_ENV | |
echo "mold_latest_tag_name=$(curl -sSL --fail --retry 5 --retry-delay 10 --retry-max-time 60 -H 'Accept: application/vnd.github.v3+json' \ | |
"${GITHUB_API_BASEURL}/repos/rui314/mold/releases/latest" | | |
grep -F 'tag_name' | cut -d'"' -f4)" >> $GITHUB_ENV | |
echo "github_release_latest_tag_name=$(curl -sSL --fail --retry 5 --retry-delay 10 --retry-max-time 60 -H 'Accept: application/vnd.github.v3+json' \ | |
"${GITHUB_API_BASEURL}/repos/github-release/github-release/releases/latest" | | |
grep -F 'tag_name' | cut -d'"' -f4)" >> $GITHUB_ENV | |
echo "go_mmproxy_latest_commit_hash=$(curl -sL -H 'Accept: application/vnd.github.v3+json' \ | |
"${GITHUB_API_BASEURL}/repos/goreleaser/nfpm/commits?per_page=1" | | |
grep -Fm1 'sha' | cut -d'"' -f4)" >> $GITHUB_ENV | |
echo "nfpm_latest_commit_hash=$(curl -sL -H 'Accept: application/vnd.github.v3+json' \ | |
"${GITHUB_API_BASEURL}/repos/goreleaser/nfpm/commits?per_page=1" | | |
grep -Fm1 'sha' | cut -d'"' -f4)" >> $GITHUB_ENV | |
echo "mmp_go_latest_commit_hash=$(curl -sL -H 'Accept: application/vnd.github.v3+json' \ | |
"${GITHUB_API_BASEURL}/repos/Qv2ray/mmp-go/commits?per_page=1" | | |
grep -Fm1 'sha' | cut -d'"' -f4)" >> $GITHUB_ENV | |
echo "CADDY_VERSION=$(curl -sL -H 'Accept: application/vnd.github.v3+json' \ | |
"${GITHUB_API_BASEURL}/repos/caddyserver/caddy/commits?per_page=1" | | |
grep -Fm1 'sha' | cut -d'"' -f4)" >> $GITHUB_ENV | |
echo "caddydns_cloudflare_latest_commit_hash=$(curl -sL -H 'Accept: application/vnd.github.v3+json' \ | |
"${GITHUB_API_BASEURL}/repos/caddy-dns/cloudflare/commits?per_page=1" | | |
grep -Fm1 'sha' | cut -d'"' -f4)" >> $GITHUB_ENV | |
echo "caddy_jsoncadapter_latest_commit_hash=$(curl -sL -H 'Accept: application/vnd.github.v3+json' \ | |
"${GITHUB_API_BASEURL}/repos/caddyserver/jsonc-adapter/commits?per_page=1" | | |
grep -Fm1 'sha' | cut -d'"' -f4)" >> $GITHUB_ENV | |
echo "caddy_l4_latest_commit_hash=$(curl -sL -H 'Accept: application/vnd.github.v3+json' \ | |
"${GITHUB_API_BASEURL}/repos/mholt/caddy-l4/commits?per_page=1" | | |
grep -Fm1 'sha' | cut -d'"' -f4)" >> $GITHUB_ENV | |
echo "age_latest_commit_hash=$(curl -sL -H 'Accept: application/vnd.github.v3+json' \ | |
"${GITHUB_API_BASEURL}/repos/FiloSottile/age/commits?per_page=1" | | |
grep -Fm1 'sha' | cut -d'"' -f4)" >> $GITHUB_ENV | |
echo "mtg_latest_commit_hash=$(curl -sL -H 'Accept: application/vnd.github.v3+json' \ | |
"${GITHUB_API_BASEURL}/repos/9seconds/mtg/commits?per_page=1" | | |
grep -Fm1 'sha' | cut -d'"' -f4)" >> $GITHUB_ENV | |
echo "pget_latest_tag_name=$(curl -sSL --fail --retry 5 --retry-delay 10 --retry-max-time 60 -H 'Accept: application/vnd.github.v3+json' \ | |
"${GITHUB_API_BASEURL}/repos/Code-Hex/pget/releases/latest" | | |
grep -F 'tag_name' | cut -d'"' -f4)" >> $GITHUB_ENV | |
echo "shfmt_latest_commit_hash=$(curl -sL -H 'Accept: application/vnd.github.v3+json' \ | |
"${GITHUB_API_BASEURL}/repos/mvdan/sh/commits?per_page=1&path=go.mod" | | |
grep -Fm1 'sha' | cut -d'"' -f4)" >> $GITHUB_ENV | |
echo "croc_latest_commit_hash=$(curl -sL -H 'Accept: application/vnd.github.v3+json' \ | |
"${GITHUB_API_BASEURL}/repos/schollz/croc/commits?per_page=1" | | |
grep -Fm1 'sha' | cut -d'"' -f4)" >> $GITHUB_ENV | |
echo "shadowsocks_go_latest_commit_hash=$(curl -sL -H 'Accept: application/vnd.github.v3+json' \ | |
"${GITHUB_API_BASEURL}/repos/shadowsocks/go-shadowsocks2/commits?per_page=1" | | |
grep -Fm1 'sha' | cut -d'"' -f4)" >> $GITHUB_ENV | |
echo "nali_latest_commit_hash=$(curl -sL -H 'Accept: application/vnd.github.v3+json' \ | |
"${GITHUB_API_BASEURL}/repos/zu1k/nali/commits?per_page=1&path=go.mod" | | |
grep -Fm1 'sha' | cut -d'"' -f4)" >> $GITHUB_ENV | |
echo "wgcf_latest_commit_hash=$(curl -sL -H 'Accept: application/vnd.github.v3+json' \ | |
"${GITHUB_API_BASEURL}/repos/ViRb3/wgcf/commits?per_page=1" | | |
grep -Fm1 'sha' | cut -d'"' -f4)" >> $GITHUB_ENV | |
echo "dive_latest_tag_name=$(curl -sSL --fail --retry 5 --retry-delay 10 --retry-max-time 60 -H 'Accept: application/vnd.github.v3+json' \ | |
"${GITHUB_API_BASEURL}/repos/wagoodman/dive/releases/latest" | | |
grep -F 'tag_name' | cut -d'"' -f4)" >> $GITHUB_ENV | |
echo "dive_latest_commit_hash=$(curl -sL -H 'Accept: application/vnd.github.v3+json' \ | |
"${GITHUB_API_BASEURL}/repos/wagoodman/dive/commits?per_page=1" | | |
grep -Fm1 'sha' | cut -d'"' -f4)" >> $GITHUB_ENV | |
echo "duf_latest_commit_hash=$(curl -sL -H 'Accept: application/vnd.github.v3+json' \ | |
"${GITHUB_API_BASEURL}/repos/muesli/duf/commits?per_page=1&path=go.mod" | | |
grep -Fm1 'sha' | cut -d'"' -f4)" >> $GITHUB_ENV | |
echo "wuzz_latest_commit_hash=$(curl -sL -H 'Accept: application/vnd.github.v3+json' \ | |
"${GITHUB_API_BASEURL}/repos/asciimoo/wuzz/commits?per_page=1" | | |
grep -Fm1 'sha' | cut -d'"' -f4)" >> $GITHUB_ENV | |
echo "httpstat_latest_commit_hash=$(curl -sL -H 'Accept: application/vnd.github.v3+json' \ | |
"${GITHUB_API_BASEURL}/repos/davecheney/httpstat/commits?per_page=1" | | |
grep -Fm1 'sha' | cut -d'"' -f4)" >> $GITHUB_ENV | |
# echo "chisel_latest_commit_hash=$(curl -sL -H 'Accept: application/vnd.github.v3+json' \ | |
# "${GITHUB_API_BASEURL}/repos/jpillora/chisel/commits?per_page=1" | | |
# grep -Fm1 'sha' | cut -d'"' -f4)" >> $GITHUB_ENV | |
echo "cloudflarespeedtest_latest_commit_hash=$(curl -sL -H 'Accept: application/vnd.github.v3+json' \ | |
"${GITHUB_API_BASEURL}/repos/XIU2/CloudflareSpeedTest/commits?per_page=1" | | |
grep -Fm1 'sha' | cut -d'"' -f4)" >> $GITHUB_ENV | |
echo "netflix_verify_latest_commit_hash=$(curl -sL -H 'Accept: application/vnd.github.v3+json' \ | |
"${GITHUB_API_BASEURL}/repos/sjlleo/netflix-verify/commits?per_page=1" | | |
grep -Fm1 'sha' | cut -d'"' -f4)" >> $GITHUB_ENV | |
echo "piknik_latest_commit_hash=$(curl -sL -H 'Accept: application/vnd.github.v3+json' \ | |
"${GITHUB_API_BASEURL}/repos/jedisct1/piknik/commits?per_page=1" | | |
grep -Fm1 'sha' | cut -d'"' -f4)" >> $GITHUB_ENV | |
echo "apk_file_latest_tag_name=$(curl -sSL --fail --retry 5 --retry-delay 10 --retry-max-time 60 -H 'Accept: application/vnd.github.v3+json' \ | |
"${GITHUB_API_BASEURL}/repos/genuinetools/apk-file/releases/latest" | | |
grep -F 'tag_name' | cut -d'"' -f4)" >> $GITHUB_ENV | |
echo "golang_latest_tag_name=$(for i in {1..16}; do \ | |
if curl -sSL --fail --retry 5 --retry-delay 10 --retry-max-time 60 -H 'Accept: application/vnd.github.v3+json' \ | |
"${GITHUB_API_BASEURL}/repos/golang/go/tags?per_page=100&page=$i" | | |
grep -F 'name' | cut -d'"' -f4 | grep -vE 'alpha|beta|rc|test|week' | | |
grep -Em1 '^go[0-9]+\.[0-9]+\.[0-9]+'; | |
then break | |
fi | |
done)" >> $GITHUB_ENV | |
echo "build_base_date=$(TZ=':Asia/Taipei' date +%F)" >> $GITHUB_ENV | |
echo "cachebust=$(date +%s)" >> $GITHUB_ENV | |
set +x | |
shell: bash | |
# Runs a set of commands using the runners shell | |
- name: Force push `release` branch | |
run: | | |
git config --local user.name "actions" | |
git config --local user.email "action@github.com" | |
git checkout release | |
git reset --hard origin/master | |
sed -i -E "s/^ARG github_release_latest_tag_name=.+/ARG github_release_latest_tag_name=${github_release_latest_tag_name:?empty value}/" Dockerfile | |
sed -i -E "s/^ARG go_mmproxy_latest_commit_hash=.+/ARG go_mmproxy_latest_commit_hash=${go_mmproxy_latest_commit_hash:?empty value}/" Dockerfile | |
sed -i -E "s/^ARG nfpm_latest_commit_hash=.+/ARG nfpm_latest_commit_hash=${nfpm_latest_commit_hash:?empty value}/" Dockerfile | |
sed -i -E "s/^ARG mmp_go_latest_commit_hash=.+/ARG mmp_go_latest_commit_hash=${mmp_go_latest_commit_hash:?empty value}/" Dockerfile | |
sed -i -E "s/^ARG CADDY_VERSION=.+/ARG CADDY_VERSION=${CADDY_VERSION:?empty value}/" Dockerfile | |
sed -i -E "s/^ARG caddydns_cloudflare_latest_commit_hash=.+/ARG caddydns_cloudflare_latest_commit_hash=${caddydns_cloudflare_latest_commit_hash:?empty value}/" Dockerfile | |
sed -i -E "s/^ARG caddy_jsoncadapter_latest_commit_hash=.+/ARG caddy_jsoncadapter_latest_commit_hash=${caddy_jsoncadapter_latest_commit_hash:?empty value}/" Dockerfile | |
sed -i -E "s/^ARG caddy_l4_latest_commit_hash=.+/ARG caddy_l4_latest_commit_hash=${caddy_l4_latest_commit_hash:?empty value}/" Dockerfile | |
sed -i -E "s/^ARG age_latest_commit_hash=.+/ARG age_latest_commit_hash=${age_latest_commit_hash:?empty value}/" Dockerfile | |
sed -i -E "s/^ARG mtg_latest_commit_hash=.+/ARG mtg_latest_commit_hash=${mtg_latest_commit_hash:?empty value}/" Dockerfile | |
sed -i -E "s/^ARG pget_latest_tag_name=.+/ARG pget_latest_tag_name=${pget_latest_tag_name:?empty value}/" Dockerfile | |
sed -i -E "s/^ARG shfmt_latest_commit_hash=.+/ARG shfmt_latest_commit_hash=${shfmt_latest_commit_hash:?empty value}/" Dockerfile | |
sed -i -E "s/^ARG croc_latest_commit_hash=.+/ARG croc_latest_commit_hash=${croc_latest_commit_hash:?empty value}/" Dockerfile | |
sed -i -E "s/^ARG shadowsocks_go_latest_commit_hash=.+/ARG shadowsocks_go_latest_commit_hash=${shadowsocks_go_latest_commit_hash:?empty value}/" Dockerfile | |
sed -i -E "s/^ARG nali_latest_commit_hash=.+/ARG nali_latest_commit_hash=${nali_latest_commit_hash:?empty value}/" Dockerfile | |
sed -i -E "s/^ARG wgcf_latest_commit_hash=.+/ARG wgcf_latest_commit_hash=${wgcf_latest_commit_hash:?empty value}/" Dockerfile | |
sed -i -E "s/^ARG dive_latest_tag_name=.+/ARG dive_latest_tag_name=${dive_latest_tag_name:?empty value}/" Dockerfile | |
sed -i -E "s/^ARG dive_latest_commit_hash=.+/ARG dive_latest_commit_hash=${dive_latest_commit_hash:?empty value}/" Dockerfile | |
sed -i -E "s/^ARG duf_latest_commit_hash=.+/ARG duf_latest_commit_hash=${duf_latest_commit_hash:?empty value}/" Dockerfile | |
sed -i -E "s/^ARG wuzz_latest_commit_hash=.+/ARG wuzz_latest_commit_hash=${wuzz_latest_commit_hash:?empty value}/" Dockerfile | |
sed -i -E "s/^ARG httpstat_latest_commit_hash=.+/ARG httpstat_latest_commit_hash=${httpstat_latest_commit_hash:?empty value}/" Dockerfile | |
# sed -i -E "s/^ARG chisel_latest_commit_hash=.+/ARG chisel_latest_commit_hash=${chisel_latest_commit_hash:?empty value}/" Dockerfile | |
sed -i -E "s/^ARG cloudflarespeedtest_latest_commit_hash=.+/ARG cloudflarespeedtest_latest_commit_hash=${cloudflarespeedtest_latest_commit_hash:?empty value}/" Dockerfile | |
sed -i -E "s/^ARG netflix_verify_latest_commit_hash=.+/ARG netflix_verify_latest_commit_hash=${netflix_verify_latest_commit_hash:?empty value}/" Dockerfile | |
sed -i -E "s/^ARG piknik_latest_commit_hash=.+/ARG piknik_latest_commit_hash=${piknik_latest_commit_hash:?empty value}/" Dockerfile | |
sed -i -E "s/^ARG apk_file_latest_tag_name=.+/ARG apk_file_latest_tag_name=${apk_file_latest_tag_name:?empty value}/" Dockerfile | |
sed -i -E "s/^ARG cachebust=.+/ARG cachebust=${cachebust:?empty value}/" Dockerfile | |
git add Dockerfile | |
git rm getting_start.sh alpine_getting_start.sh void_getting_start.sh build_base.Dockerfile | |
git rm -r .github | |
git commit -m "${{ env.RELEASE_NAME }}" | |
git push -f -u origin release | |
- name: Force push `build_base` branch | |
run: | | |
git config --local user.name "actions" | |
git config --local user.email "action@github.com" | |
git checkout build_base | |
git reset --hard origin/master | |
sed -i -E "s/^ARG checksec_latest_tag_name=.+/ARG checksec_latest_tag_name=${checksec_latest_tag_name:?empty value}/" build_base.Dockerfile | |
sed -i -E "s/^ARG bashrc_latest_commit_hash=.+/ARG bashrc_latest_commit_hash=${bashrc_latest_commit_hash:?empty value}/" build_base.Dockerfile | |
sed -i -E "s/^ARG mold_latest_tag_name=.+/ARG mold_latest_tag_name=${mold_latest_tag_name:?empty value}/" build_base.Dockerfile | |
sed -i -E "s/^ARG golang_latest_tag_name=.+/ARG golang_latest_tag_name=${golang_latest_tag_name:?empty value}/" build_base.Dockerfile | |
sed -i -E "s/^ARG build_base_date=.+/ARG build_base_date=${build_base_date:?empty value}/" build_base.Dockerfile | |
git add build_base.Dockerfile | |
git rm getting_start.sh alpine_getting_start.sh void_getting_start.sh Dockerfile | |
git rm -r .github | |
git commit -m "${{ env.RELEASE_NAME }}" | |
git push -f -u origin build_base |