Files
FFmpeg/.github/workflows/refresh.yml
T
Michael Fabian 'Xaymar' Dirks 3cfe4b67a2 ci: Use matrix instead of parameter for patches
The matrix build type can take care of most if not all optional configurations, so there is no point in having this as an argument. In any case we'd want both normal and patched builds anyway.
2021-05-23 22:28:20 +02:00

107 lines
4.1 KiB
YAML

name: Refresh
on:
schedule:
- cron: '0 0 * * 0'
push:
branches:
- 'automation'
- 'automation-test'
jobs:
update:
runs-on: ubuntu-latest
name: "Update Mirror"
steps:
- uses: actions/checkout@v2
name: "Checkout"
- name: "Configure"
shell: bash
run: |
git config --global user.name 'GitHub Actions'
git config --global user.email 'xaymar@users.noreply.github.com'
git config pull.ff only
git config pull.rebase true
- name: "Remotes"
if: ${{ github.event_name == 'schedule' }}
shell: bash
run: |
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
git remote add -f --tags remote https://git.ffmpeg.org/ffmpeg.git
git fetch --all
- name: "Synchronize with Remote and trigger Builds"
if: ${{ github.event_name == 'schedule' }}
shell: bash
run: |
declare -a BRANCHES
BRANCHES[${#BRANCHES[@]}]="master"
BRANCHES[${#BRANCHES[@]}]="release/4.4"
BRANCHES[${#BRANCHES[@]}]="release/4.3"
BRANCHES[${#BRANCHES[@]}]="release/4.2"
BRANCHES[${#BRANCHES[@]}]="release/4.1"
BRANCHES[${#BRANCHES[@]}]="release/4.0"
BRANCHES[${#BRANCHES[@]}]="release/3.4"
BRANCHES[${#BRANCHES[@]}]="release/3.3"
BRANCHES[${#BRANCHES[@]}]="release/3.2"
BRANCHES[${#BRANCHES[@]}]="release/3.1"
BRANCHES[${#BRANCHES[@]}]="release/3.0"
BRANCHES[${#BRANCHES[@]}]="release/2.8"
BRANCHES[${#BRANCHES[@]}]="release/2.7"
BRANCHES[${#BRANCHES[@]}]="release/2.6"
BRANCHES[${#BRANCHES[@]}]="release/2.5"
BRANCHES[${#BRANCHES[@]}]="release/2.4"
BRANCHES[${#BRANCHES[@]}]="release/2.3"
BRANCHES[${#BRANCHES[@]}]="release/2.2"
BRANCHES[${#BRANCHES[@]}]="release/2.1"
BRANCHES[${#BRANCHES[@]}]="release/2.0"
BRANCHES[${#BRANCHES[@]}]="release/1.2"
BRANCHES[${#BRANCHES[@]}]="release/1.1"
BRANCHES[${#BRANCHES[@]}]="release/1.0"
BRANCHES[${#BRANCHES[@]}]="release/0.11"
BRANCHES[${#BRANCHES[@]}]="release/0.10"
BRANCHES[${#BRANCHES[@]}]="release/0.9"
BRANCHES[${#BRANCHES[@]}]="release/0.8"
BRANCHES[${#BRANCHES[@]}]="release/0.7"
BRANCHES[${#BRANCHES[@]}]="release/0.6"
BRANCHES[${#BRANCHES[@]}]="release/0.5"
BRANCHES[${#BRANCHES[@]}]="oldabi"
echo "Testing branches for differences..."
for d in ${BRANCHES[@]}; do
BRANCH_REQUIRES_UPDATE=false
if ! git branch -a | grep origin/${d} > /dev/null; then
echo " '${d}' is missing, creating..."
BRANCH_REQUIRES_UPDATE=true
elif ! git diff -s --exit-code origin/${d} remote/${d} > /dev/null; then
echo " '${d}' is out of date, updating..."
BRANCH_REQUIRES_UPDATE=true
fi
# Always check out the remote branch.
git checkout -b "${d}" "remote/${d}" > /dev/null
if ${BRANCH_REQUIRES_UPDATE}; then
git push --follow-tags --set-upstream origin ${d}
curl -s --show-error \
-X POST \
-H "Authorization: token ${{ secrets.WORKFLOW_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
-d "{\"ref\":\"${{ github.ref }}\",\"inputs\":{\"ref\":\"${d}\"}}" \
"https://api.github.com/repos/${{ github.repository }}/actions/workflows/build.yml/dispatches"
fi
done
- name: "Only trigger build on manual push"
if: ${{ github.event_name == 'push' }}
shell: bash
run: |
declare -a BRANCHES
BRANCHES[${#BRANCHES[@]}]="master"
for d in ${BRANCHES[@]}; do
curl -s --show-error \
-X POST \
-H "Authorization: token ${{ secrets.WORKFLOW_TOKEN }}" \
-H "Accept: application/vnd.github.v3+json" \
-d "{\"ref\":\"${{ github.ref }}\",\"inputs\":{\"ref\":\"${d}\"}}" \
"https://api.github.com/repos/${{ github.repository }}/actions/workflows/build.yml/dispatches"
done