55 lines
1.9 KiB
YAML
55 lines
1.9 KiB
YAML
on:
|
|
workflow_dispatch:
|
|
inputs:
|
|
tags:
|
|
description: 'tag list'
|
|
type: string
|
|
required: false
|
|
default: ''
|
|
schedule:
|
|
- cron: '2 */12 * * *'
|
|
|
|
jobs:
|
|
synchronize-upstream:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- run: gh repo clone discretizer/homepage && cd homepage
|
|
- name: Fetch Upstream Tags
|
|
id: fetch-upstream-tags
|
|
if: ${{ !inputs.tags }}
|
|
run: |
|
|
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:
|
|
NEW_TAGS: ${{inputs.tags || steps.fetch-upstream-tags.outputs.NEW_TAGS}}
|
|
- name: Push Current
|
|
run: |
|
|
git checkout -b current upstream
|
|
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 current
|
|
env:
|
|
GH_TOKEN: ${{ github.token }}
|
|
|
|
|