Partner Charts CI #104
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
# Authors: Samuel Attwood, Nefi Munoz | |
name: Partner Charts CI | |
on: | |
workflow_dispatch: | |
# push: | |
# branches: | |
# - main-source | |
jobs: | |
sync: #this job should run first | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout main-source branch | |
uses: actions/checkout@v3 | |
with: | |
ref: main-source # branch you want to sync | |
repository: nflondo/partner-charts # your forked repository URL | |
- name: Configure Git | |
run: | | |
git config --global user.name "github-actions[bot]" | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
- name: Fetch upstream changes for main-source branch | |
run: | | |
git remote add upstream https://github.com/rancher/partner-charts.git # URL of upstream repository | |
git fetch upstream main-source | |
- name: Merge upstream changes into main-source branch | |
run: | | |
git checkout main-source | |
git merge upstream/main-source --allow-unrelated-histories --no-edit | |
git push origin main-source | |
- name: Merge upstream changes into main branch | |
run: | | |
git fetch upstream main # this fetch is necessary here | |
git checkout main | |
git merge upstream/main --allow-unrelated-histories --no-edit | |
git push origin main | |
build: | |
needs: sync #this job should run after "sync" job | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout main-source branch | |
uses: actions/checkout@v3 | |
- name: Setup go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: '>=1.17.0' | |
- name: Run CI | |
run: | | |
git config --global user.name "github-actions[bot]" | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
git config --global pull.rebase false # merge (this is the default) | |
scripts/pull-ci-scripts | |
bin/partner-charts-ci auto | |
git pull origin main-source | |
git push origin main-source | |
- name: Update main branch | |
run: | | |
# checkout action is only going to fetch the current branch, so "git checkout main" would fail if we don’t fetch main first | |
git fetch origin main --depth 1 | |
git checkout main | |
rm -r assets index.yaml | |
git checkout main-source -- index.yaml assets | |
- name: Auto commit & push | |
# Defaults pushing to current branch (main) | |
uses: stefanzweifel/git-auto-commit-action@v4 | |
with: | |
commit_message: "Release Partner Charts" |