Sync with Upstream #73
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 'Sync with Upstream' | |
on: | |
schedule: | |
- cron: '0 6 * * *' | |
#scheduled at 06:00 everyday | |
workflow_dispatch: {} | |
permissions: | |
actions: write | |
contents: write | |
jobs: | |
sync-with-upstream-main: | |
runs-on: ubuntu-latest | |
name: Sync with upstream main | |
steps: | |
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 | |
with: | |
fetch-depth: 0 | |
token: ${{ secrets.WORKFLOW_TOKEN }} | |
- name: Sync upstream changes | |
id: sync | |
uses: aormsby/Fork-Sync-With-Upstream-action@v3.4.1 | |
with: | |
target_sync_branch: main | |
target_repo_token: ${{ secrets.WORKFLOW_TOKEN }} | |
target_branch_push_args: "-f --tags" | |
upstream_sync_branch: main | |
upstream_sync_repo: envoyproxy/go-control-plane | |
upstream_pull_args: "--tags" | |
test_mode: false | |
git_config_pull_rebase: true | |
- run: | | |
git config --global user.email "lukidzi@users.noreply.github.com" | |
git config --global user.name "lukidzi" | |
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0 | |
with: | |
fetch-depth: 0 | |
token: ${{ secrets.WORKFLOW_TOKEN }} | |
- name: New commits found | |
if: steps.sync.outputs.has_new_commits == 'true' | |
run: echo "New commits were found to sync." | |
- name: No new commits | |
if: steps.sync.outputs.has_new_commits == 'false' | |
run: echo "There were no new commits." | |
- name: Get new version tag | |
id: new-version-tag | |
if: steps.sync.outputs.has_new_commits == 'true' | |
shell: bash | |
run: | | |
git tag --list --merged origin/main --sort=-creatordate | |
.github/scripts/get-version-tags.sh | |
- name: Print tags | |
run: | | |
echo ${{ steps.new-version-tag.outputs.released_tag }} | |
echo ${{ steps.new-version-tag.outputs.main_tag }} | |
echo ${{ steps.new-version-tag.outputs.new_tag }} | |
- name: Release new version | |
if: steps.new-version-tag.outputs.released_tag != steps.new-version-tag.outputs.main_tag | |
run: | | |
git remote -v | |
git checkout release | |
git pull | |
git rebase --onto ${{ steps.new-version-tag.outputs.main_tag }} ${{ steps.new-version-tag.outputs.released_tag }} release | |
git tag ${{ steps.new-version-tag.outputs.new_tag }} | |
git push origin release --tags -f |