Skip to content

Bump

Bump #4244

Workflow file for this run

name: Bump
on:
workflow_dispatch:
schedule:
- cron: "50 1-23/8 * * *"
push:
branches:
- master
paths-ignore:
- "**/LICENSE"
- "**/README.md"
- "**/got_github_release.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 "jemalloc_latest_tag_name=$(curl -sL -H 'Accept: application/vnd.github.v3+json' \
"${GITHUB_API_BASEURL}/repos/jemalloc/jemalloc/releases/latest" |
grep -F 'tag_name' | cut -d'"' -f4)" >> $GITHUB_ENV
echo "jemalloc_latest_commit_hash=$(curl -sSL --fail --retry 5 --retry-delay 10 --retry-max-time 60 -H 'Accept: application/vnd.github.v3+json' \
"${GITHUB_API_BASEURL}/repos/jemalloc/jemalloc/commits?per_page=1" |
grep -Fm1 'sha' | cut -d'"' -f4)" >> $GITHUB_ENV
echo "lua_version=$(curl -sSL \
"https://www.lua.org/download.html" | tr -d '\r\n\t' |
grep -Po '(?<=lua-)[0-9]\.[0-9]\.[0-9](?=\.tar\.gz)' | sort -Vr | head -n 1)" >> $GITHUB_ENV
echo "haproxy_branch=2.4" >> $GITHUB_ENV
echo "haproxy_latest_commit_hash=$(export haproxy_branch=2.4 && curl -sSL \
"https://git.haproxy.org/?p=haproxy-${haproxy_branch}.git;a=commit;h=refs/heads/master" | tr -d '\r\n\t' |
grep -Po '(?<=<td>commit<\/td><td class="sha1">)[a-zA-Z0-9]+(?=<\/td>)')" >> $GITHUB_ENV
echo "haproxy_latest_tag_name=$(export haproxy_branch=2.4 && curl -sSL \
"https://git.haproxy.org/?p=haproxy-${haproxy_branch}.git;a=tags" | tr -d '\r\n\t' |
grep -Po "(?<=a=shortlog;h=refs\/tags\/v)${haproxy_branch}\.[0-9]+" |
LC_ALL=C sort -Vr | head -n 1)" >> $GITHUB_ENV
echo "image_build_date=$(TZ=':Asia/Taipei' date +%F)" >> $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 "[email protected]"
git checkout release
git reset --hard origin/master
sed -i -E "s/^ARG jemalloc_latest_tag_name=.+/ARG jemalloc_latest_tag_name=${jemalloc_latest_tag_name:?empty value}/" haproxy_alpine_builder.Dockerfile haproxy_debian_builder.Dockerfile release_haproxy_alpine.Dockerfile release_haproxy_debian.Dockerfile
sed -i -E "s/^ARG jemalloc_latest_commit_hash=.+/ARG jemalloc_latest_commit_hash=${jemalloc_latest_commit_hash:?empty value}/" haproxy_alpine_builder.Dockerfile haproxy_debian_builder.Dockerfile release_haproxy_alpine.Dockerfile release_haproxy_debian.Dockerfile
sed -i -E "s/^ARG haproxy_branch=.+/ARG haproxy_branch=${haproxy_branch:?empty value}/" haproxy_alpine_builder.Dockerfile haproxy_debian_builder.Dockerfile release_haproxy_alpine.Dockerfile release_haproxy_debian.Dockerfile
sed -i -E "s/^ARG haproxy_latest_commit_hash=.+/ARG haproxy_latest_commit_hash=${haproxy_latest_commit_hash:?empty value}/" haproxy_alpine_builder.Dockerfile haproxy_debian_builder.Dockerfile release_haproxy_alpine.Dockerfile release_haproxy_debian.Dockerfile
sed -i -E "s/^ARG haproxy_latest_tag_name=.+/ARG haproxy_latest_tag_name=${haproxy_latest_tag_name:?empty value}/" haproxy_alpine_builder.Dockerfile haproxy_debian_builder.Dockerfile release_haproxy_alpine.Dockerfile release_haproxy_debian.Dockerfile
sed -i -E "s/^ARG lua_version=.+/ARG lua_version=${lua_version:?empty value}/" haproxy_alpine_builder.Dockerfile haproxy_debian_builder.Dockerfile
sed -i -E "s/^ARG image_build_date=.+/ARG image_build_date=${image_build_date:?empty value}/" haproxy_alpine_builder.Dockerfile haproxy_debian_builder.Dockerfile
git add haproxy_alpine_builder.Dockerfile haproxy_debian_builder.Dockerfile release_haproxy_alpine.Dockerfile release_haproxy_debian.Dockerfile got_github_release.sh
git rm README.md
git rm -r .github
git commit -m "${{ env.RELEASE_NAME }}"
git push -f -u origin release