Skip to content

Git release workflow #1059

Git release workflow

Git release workflow #1059

Workflow file for this run

name: Git release workflow
on:
workflow_dispatch:
schedule:
- cron: '0 15 * * *'
jobs:
update:
name: update
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-24.04, ubuntu-22.04, ubuntu-20.04]
steps:
- name: Update lists
run: |
. /etc/os-release
dpkg -l | awk '($1 == "ii") && ($2 ~ /^lib|lib$/) { print $2 }' | sed 's/:amd64//' > /tmp/"$VERSION_CODENAME"-libs
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: lists-${{ matrix.os }}
path: |
/tmp/*-libs
sync:
name: sync
needs: update
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ref: develop
fetch-depth: 0
- name: Download lists
uses: actions/download-artifact@v4
with:
pattern: lists-*
merge-multiple: true
path: src/lists
- name: Add brew to PATH
run: echo "/home/linuxbrew/.linuxbrew/bin" >> $GITHUB_PATH
- name: Update darwin extensions list
run: |
brew tap shivammathur/extensions
find "$(brew --repository shivammathur/extensions)"/.github/deps -mindepth 1 -type d -name "*" -exec basename {} \; | sort > src/lists/darwin-extensions
- name: Update tags and branches
run: |
push_ref() {
ref=$1
git push -f https://${{ github.repository_owner }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git "$ref" || true
}
git config --local user.email "$bot_user_id+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
if [ "$(git status --porcelain=v1 2>/dev/null | wc -l)" != "0" ]; then
git add .
git commit -m "Updating lists"
fi
push_ref develop
semver=$(git for-each-ref --sort=version:refname --format '%(refname:short)' refs/tags | grep -E '^[0-9]+\.[0-9]+\.[0-9]+$' | tail -n 1)
rolling=$(git tag --sort=-refname | awk 'match($0, /^v[0-9]/)' | head -n 1)
for branch in master releases/$rolling; do
git checkout $branch
if [ "$(git rev-parse "$branch")" != "$(git rev-parse develop)" ]; then
git merge --allow-unrelated-histories develop || true
fi
push_ref "$branch"
done
for tag in $semver $rolling; do
git tag -fa "$tag" -m "Update %1 tag"
push_ref "$tag"
done