create-pr #321
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: create pr | |
on: | |
repository_dispatch: | |
types: [create-pr] | |
jobs: | |
enterprise-pr-release: | |
name: update oss latest release | |
runs-on: ubuntu-latest | |
steps: | |
- name: Setup Go | |
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0 | |
with: | |
go-version: 1.20.x | |
- name: Check out enterprise | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
with: | |
repository: "weaveworks/weave-gitops-enterprise" | |
token: ${{ secrets.GITHUB_TOKEN }} | |
ref: main | |
fetch-depth: 0 | |
- name: Fetch latest tag from weave-gitops | |
id: fetch-latest-tag | |
run: | | |
latest_tag=$(git ls-remote --tags https://github.com/weaveworks/weave-gitops.git | awk -F/ '$NF ~ /^v[0-9]+\.[0-9]+\.[0-9]+$/ {print $NF}' | sort -V | tail -n1) | |
echo "::set-output name=tag::$latest_tag" | |
- name: Configure git for private modules | |
env: | |
GITHUB_BUILD_USERNAME: wge-build-bot | |
GITHUB_BUILD_TOKEN: ${{ secrets.BUILD_BOT_PERSONAL_ACCESS_TOKEN }} | |
run: git config --global url."https://${GITHUB_BUILD_USERNAME}:${GITHUB_BUILD_TOKEN}@github.com".insteadOf "https://github.com" | |
- name: Upgrade main version | |
run: | | |
set -x | |
latest_tag=${{ steps.fetch-latest-tag.outputs.tag }} | |
export GOPRIVATE=github.com/weaveworks | |
go get -u github.com/weaveworks/weave-gitops@$latest_tag | |
go mod tidy | |
yarn add @weaveworks/weave-gitops@$latest_tag | |
# This is a convience to help auto-update snapshots if core components have changed. | |
# However it can still fail if larger changes have been made, breaking the PR creation. | |
# In this case we still want to continue w/ PR creation and fixes can be made in the EE PR manually. | |
# So we do a `|| true` to continue this workflow even on failure. | |
yarn test -u || true | |
env: | |
GITHUB_TOKEN: ${{ secrets.BUILD_BOT_PERSONAL_ACCESS_TOKEN}} | |
- name: Create Pull Request | |
id: create-pull-request | |
uses: peter-evans/create-pull-request@153407881ec5c347639a548ade7d8ad1d6740e38 # v5.0.2 | |
with: | |
author: wge-build-bot <[email protected]> | |
signoff: true | |
committer: wge-build-bot <[email protected]> | |
branch: track-released-oss | |
base: main | |
title: "Bump weave-gitops to latest ${{ steps.fetch-latest-tag.outputs.tag }}" | |
body: | | |
Update weave-gitops to latest release ${{ steps.fetch-latest-tag.outputs.tag }} | |
# Uncomment this when you want to involve the author: | |
# | |
# cc @${{ github.event.sender.login }} | |
commit-message: "Bump version of weave-gitops to latest" | |
token: ${{ secrets.BUILD_BOT_PERSONAL_ACCESS_TOKEN }} | |
delete-branch: true | |
labels: "exclude from release notes" | |
enterprise-pr-main: | |
name: update oss main | |
runs-on: ubuntu-latest | |
steps: | |
- name: Setup Go | |
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0 | |
with: | |
go-version: 1.20.x | |
- name: Check out enterprise | |
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
with: | |
repository: "weaveworks/weave-gitops-enterprise" | |
token: ${{ secrets.GITHUB_TOKEN }} | |
ref: main | |
fetch-depth: 0 | |
- name: Fetch unmerged changes | |
run: | | |
git config user.name wks-ci-test-bot | |
git config user.email [email protected] | |
git fetch origin | |
if git rev-parse -q --verify origin/track-latest-oss; then | |
git checkout origin/track-latest-oss | |
git merge origin/main | |
fi | |
- name: Configure git for private modules | |
env: | |
GITHUB_BUILD_USERNAME: wge-build-bot | |
GITHUB_BUILD_TOKEN: ${{ secrets.BUILD_BOT_PERSONAL_ACCESS_TOKEN }} | |
run: git config --global url."https://${GITHUB_BUILD_USERNAME}:${GITHUB_BUILD_TOKEN}@github.com".insteadOf "https://github.com" | |
- name: Upgrade main version | |
run: | | |
set -x | |
export GOPRIVATE=github.com/weaveworks | |
remote_main=$(git ls-remote https://github.com/weaveworks/weave-gitops.git refs/heads/main | awk '{print $1}') | |
echo $remote_main | |
go get -u github.com/weaveworks/weave-gitops@$remote_main | |
go mod tidy | |
npm_version=$(yarn info @weaveworks/weave-gitops-main time --json | jq -r '.data | keys | .[] | select(contains("$(remote_main)"))') | |
yarn add @weaveworks/weave-gitops@npm:@weaveworks/weave-gitops-main@$npm_version | |
# This is a convience to help auto-update snapshots if core components have changed. | |
# However it can still fail if larger changes have been made, breaking the PR creation. | |
# In this case we still want to continue w/ PR creation and fixes can be made in the EE PR manually. | |
# So we do a `|| true` to continue this workflow even on failure. | |
yarn test -u || true | |
env: | |
GITHUB_TOKEN: ${{ secrets.BUILD_BOT_PERSONAL_ACCESS_TOKEN}} | |
- name: Create Pull Request | |
id: create-pull-request | |
uses: peter-evans/create-pull-request@153407881ec5c347639a548ade7d8ad1d6740e38 # v5.0.2 | |
with: | |
author: wge-build-bot <[email protected]> | |
signoff: true | |
committer: wge-build-bot <[email protected]> | |
branch: track-latest-oss | |
base: main | |
title: "Bump weave-gitops to latest" | |
body: | | |
Update weave-gitops to unstable commit ${{ needs.ci-publish-js-lib.outputs.js-version }} | |
# Uncomment this when you want to involve the author: | |
# | |
# cc @${{ github.event.sender.login }} | |
commit-message: "Bump version of weave-gitops to latest" | |
token: ${{ secrets.BUILD_BOT_PERSONAL_ACCESS_TOKEN }} | |
delete-branch: true | |
labels: "exclude from release notes" |