Inject CI workflows before pushing new tags
All checks were successful
/ Test on tags (push) Successful in 16s
All checks were successful
/ Test on tags (push) Successful in 16s
This commit is contained in:
parent
6374271565
commit
5733b4e0cf
1 changed files with 27 additions and 23 deletions
|
@ -4,35 +4,39 @@ on:
|
|||
schedule:
|
||||
- cron: '@hourly'
|
||||
|
||||
push:
|
||||
branches:
|
||||
- 'master'
|
||||
|
||||
jobs:
|
||||
mirror:
|
||||
name: Pull from upstream
|
||||
runs-on: x86_64
|
||||
container:
|
||||
image: 'docker.io/node:20-bookworm'
|
||||
env:
|
||||
upstream: https://git.joeyh.name/git/git-annex.git
|
||||
destination: {{ vars.DESTINATION }}
|
||||
tags: '10.2024*'
|
||||
token: ${{ secrets.CODE_FORGEJO_TOKEN }}
|
||||
owner: ${{ vars.OWNER }}
|
||||
steps:
|
||||
- name: git mirror branches {v*/,}master & tags
|
||||
- name: Comparing tags of upstream and destination
|
||||
run: |
|
||||
git ls-remote $upstream "refs/tags/$tags" | grep -v '\{' | awk '\{print $2\}' | sed 's|refs/tags/||' > upstream_tags
|
||||
git ls-remote $destination "refs/tags/$tags" | grep -v '\{' | awk '\{print $2\}' | sed 's|refs/tags/||' > destination_tags
|
||||
cat upstream_tags destination_tags | tr ' ' '\n' | sort | uniq -u | tr '\n '\t' > missing_tags
|
||||
- name: Fetching missing tags
|
||||
run: |
|
||||
git init --bare .
|
||||
git remote add origin https://git.joeyh.name/git/git-annex.git
|
||||
git fetch origin refs/heads/master:refs/mirror/master
|
||||
git ls-remote origin refs/heads/v*/master | while read sha full_ref ; do
|
||||
ref=${full_ref#refs/heads/}
|
||||
git fetch origin $full_ref:refs/mirror/$ref
|
||||
tag=${ref%/master}
|
||||
git fetch origin refs/tags/${tag}*:refs/mirror-tags/${tag}*
|
||||
done
|
||||
if test "${{ vars.TEST }}" != true ; then
|
||||
token=${{ secrets.CODE_FORGEJO_TOKEN }}
|
||||
destination=${{ vars.DESTINATION }}
|
||||
owner=${{ vars.OWNER }}
|
||||
else
|
||||
token=${{ secrets.TEST_FORGEJO_TOKEN }}
|
||||
destination=${{ vars.TEST_DESTINATION }}
|
||||
owner=${{ vars.TEST_OWNER }}
|
||||
fi
|
||||
git push --force https://any:$token@$destination/$owner/git-annex refs/mirror/*:refs/heads/* refs/mirror-tags/*:refs/tags/* --tags
|
||||
git remote add origin $upstream
|
||||
while read tag; do
|
||||
git fetch origin tag $tag --no-tags
|
||||
done < missing_tags
|
||||
- name: Injecting packaging workflow
|
||||
run: |
|
||||
while read tag; do
|
||||
git checkout $tag
|
||||
git tag -d $tag
|
||||
git checkout ci -- ./forgejo
|
||||
git commit -m 'Inject custom workflow'
|
||||
git tag -a $tag -m $tag
|
||||
done < missing_tags
|
||||
- name: Pushing patched tags
|
||||
run: git push --force https://any:$token@$destination refs/tags/*:refs/tags/* --tags
|
||||
|
|
Loading…
Add table
Reference in a new issue