Fix fork-sync
This commit is contained in:
parent
b8ddc5b187
commit
a48a37c289
44
.github/workflows/fork-sync.yml
vendored
44
.github/workflows/fork-sync.yml
vendored
@ -1,5 +1,11 @@
|
|||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
inputs:
|
||||||
|
tags:
|
||||||
|
description: 'tag list'
|
||||||
|
type: string
|
||||||
|
required: false
|
||||||
|
default: ''
|
||||||
schedule:
|
schedule:
|
||||||
- cron: '2 */12 * * *'
|
- cron: '2 */12 * * *'
|
||||||
|
|
||||||
@ -7,7 +13,41 @@ jobs:
|
|||||||
synchronize-upstream:
|
synchronize-upstream:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- run: gh repo sync discretizer/homepage
|
- name: Fetch Upstream Tags
|
||||||
|
id: fetch-upstream-tags
|
||||||
|
if: ${{ !inputs.tags }}
|
||||||
|
run: |
|
||||||
|
gh repo clone dicretizer/homepage && cd homepage
|
||||||
|
git fetch --tags
|
||||||
|
fmt='
|
||||||
|
r=%(refname)
|
||||||
|
echo ${r#refs/tags/}
|
||||||
|
'
|
||||||
|
echo 'NEW_TAGS<<EOF' >> $GITHUB_OUTPUT
|
||||||
|
$(eval `git for-each-ref --format=$fmt --no-merge upstream refs/tags`) >> $GITHUB_OUTPUT
|
||||||
|
echo 'EOF' >> $GITHUB_OUTPUT
|
||||||
|
- name: Bump Current
|
||||||
|
run: |
|
||||||
|
git checkout upstream
|
||||||
|
git merge upstream/master upstream
|
||||||
|
- name: Create Tags
|
||||||
|
if: ${{inputs.tags || steps.fetch-upstream-tags.outputs.NEW_TAGS}}
|
||||||
|
run: |
|
||||||
|
for TAG in ${NEW_TAGS}; do
|
||||||
|
git checkout -b release/${TAG} ${TAG}
|
||||||
|
git rev-list --no-merges --reverse origin/feature/add_auth ^upstream | git cherry-pick --stdin
|
||||||
|
git rev-list --no-merges --reverse origin/fork/automation ^upstream -- .github/**| git cherry-pick --stdin
|
||||||
|
git tag ${TAG} release/${TAG}
|
||||||
|
done
|
||||||
|
for TAG in ${NEW_TAGS}; do git push -u origin release/${TAG} ${TAG}; done
|
||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ github.token }}
|
NEW_TAGS: ${{inputs.tags || steps.fetch-upstream-tags.outputs.NEW_TAGS}}
|
||||||
|
- name: Push Current
|
||||||
|
run: |
|
||||||
|
git rev-list --no-merges --reverse origin/feature/add_auth ^upstream | git cherry-pick --stdin
|
||||||
|
git rev-list --no-merges --reverse origin/fork/automation ^upstream -- .github/**| git cherry-pick --stdin
|
||||||
|
git push upstream release/current
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ github.token }}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user