Skip to content

Upstream Sync

Upstream Sync #94

name: 'Upstream Sync'
on:
schedule:
- cron: '45 6 * * 0'
workflow_dispatch: # click the button on Github repo!
inputs:
sync_test_mode: # Adds a boolean option that appears during manual workflow run for easy test mode config
description: 'Test Mode'
type: boolean
default: false
force_build_and_publish: # Adds a boolean option that appears during manual workflow run for easy test mode config
description: 'Force Build and Publish'
type: boolean
default: false
jobs:
sync_latest_from_upstream:
runs-on: ubuntu-latest
name: Sync latest commits from upstream repo
steps:
# REQUIRED step
# Step 1: run a standard checkout action, provided by github
- name: Checkout target repo
uses: actions/checkout@v3
with:
# optional: set the branch to checkout,
# sync action checks out your 'target_sync_branch' anyway
ref: master
# REQUIRED if your upstream repo is private (see wiki)
persist-credentials: false
# REQUIRED step
# Step 2: run the sync action
- name: Sync upstream changes
id: sync
uses: aormsby/Fork-Sync-With-Upstream-action@v3.4.1
with:
target_sync_branch: master
# REQUIRED 'target_repo_token' exactly like this!
target_repo_token: ${{ secrets.UPSTREAM_SYNC_TOKEN }}
upstream_sync_branch: master
upstream_sync_repo: brave/go-sync
upstream_repo_access_token: ${{ secrets.UPSTREAM_SYNC_TOKEN }}
# Set test_mode true during manual dispatch to run tests instead of the true action!!
test_mode: ${{ inputs.sync_test_mode }}
# Step 3: Build and Publish if new commits were merged, otherwise stop
- name: Build and Publish Server
if: ${{ (steps.sync.outputs.has_new_commits == 'true' && inputs.sync_test_mode != true) || inputs.force_build_and_publish == true }}
uses: mathze/workflow-dispatch-action@v1.1.0
with:
workflow-name: build-and-publish-server.yml
token: ${{ secrets.UPSTREAM_SYNC_TOKEN }}
- name: Build and Publish Dynamo
if: ${{ (steps.sync.outputs.has_new_commits == 'true' && inputs.sync_test_mode != true) || inputs.force_build_and_publish == true }}
uses: mathze/workflow-dispatch-action@v1.1.0
with:
workflow-name: build-and-publish-dynamo.yml
token: ${{ secrets.UPSTREAM_SYNC_TOKEN }}
- name: New commits
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."