ci: CI pipeline fixes for merge issues (#6529)
* CI fixes * update text content * Change PR to force push * releases environment for prod deploy * add runs-on * Rename third step * Update .github/workflows/1-main-to-staging.yml Co-authored-by: Zach Pomerantz <zzmp@uniswap.org> * Update .github/workflows/1-main-to-staging.yml Co-authored-by: Zach Pomerantz <zzmp@uniswap.org> * nits --------- Co-authored-by: Zach Pomerantz <zzmp@uniswap.org>
This commit is contained in:
parent
4fc4bdcd55
commit
14e3ef044e
9
.github/workflows/1-main-to-staging.yml
vendored
9
.github/workflows/1-main-to-staging.yml
vendored
@ -1,4 +1,4 @@
|
||||
name: 1 | Push main to releases/staging
|
||||
name: 1 | Push main -> staging
|
||||
|
||||
# This CI job is responsible for pushing the current contents of the `main` branch to the
|
||||
# `releases/staging` branch, which will in turn kick off a deploy to the staging environment.
|
||||
@ -12,12 +12,17 @@ jobs:
|
||||
name: 'Push to staging branch'
|
||||
runs-on: ubuntu-latest
|
||||
environment:
|
||||
name: release
|
||||
name: push/staging
|
||||
steps:
|
||||
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
|
||||
with:
|
||||
token: ${{ secrets.RELEASE_SERVICE_ACCESS_TOKEN }}
|
||||
ref: main
|
||||
- name: Add CODEOWNERS file
|
||||
run: |
|
||||
echo "@uniswap/web-admins" > CODEOWNERS
|
||||
git add CODEOWNERS
|
||||
git commit -m "ci: add global CODEOWNERS"
|
||||
- name: Git push
|
||||
run: |
|
||||
git config user.name "UL Service Account"
|
||||
|
4
.github/workflows/2-deploy-to-staging.yml
vendored
4
.github/workflows/2-deploy-to-staging.yml
vendored
@ -1,4 +1,4 @@
|
||||
name: 2 | Deploy to staging
|
||||
name: 2 | Deploy staging
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
@ -8,7 +8,7 @@ jobs:
|
||||
deploy-to-staging:
|
||||
runs-on: ubuntu-latest
|
||||
environment:
|
||||
name: staging
|
||||
name: deploy/staging
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: ./.github/actions/setup
|
||||
|
60
.github/workflows/3-staging-to-prod.yml
vendored
60
.github/workflows/3-staging-to-prod.yml
vendored
@ -1,63 +1,25 @@
|
||||
name: 3 | Generate PR for releases/staging to releases/prod
|
||||
name: 3 | Push staging -> prod
|
||||
|
||||
# This CI job is responsible for generating PRs that bring the HEAD of `releases/staging` into `releases/prod`.
|
||||
# These PRs are meant to be the only (standard) way that code is merged into the `releases/prod` branch.
|
||||
# This CI job is responsible for force pushing the content of releases/staging to releases/prod. It
|
||||
# is restricted to web-reviewers through virtue of the GitHub environment protection rules for the
|
||||
# prod environment.
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
# https://github.com/peter-evans/create-pull-request/blob/main/docs/examples.md#keep-a-branch-up-to-date-with-another
|
||||
jobs:
|
||||
prod-gen-pr:
|
||||
name: 'Generate PR for merging to releases/prod branch'
|
||||
push-prod:
|
||||
name: 'Push to prod branch'
|
||||
runs-on: ubuntu-latest
|
||||
environment:
|
||||
name: release
|
||||
name: push/prod
|
||||
steps:
|
||||
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
|
||||
with:
|
||||
token: ${{ secrets.RELEASE_SERVICE_ACCESS_TOKEN }}
|
||||
ref: main
|
||||
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab
|
||||
with:
|
||||
token: ${{ secrets.RELEASE_SERVICE_ACCESS_TOKEN }}
|
||||
ref: releases/prod
|
||||
- name: Reset promotion branch
|
||||
ref: releases/staging
|
||||
- name: Git push
|
||||
run: |
|
||||
git fetch origin releases/staging:releases/staging
|
||||
git reset --hard releases/staging
|
||||
- name: Setup git
|
||||
run: |
|
||||
git config user.name "UL Mobile Service Account"
|
||||
git config user.name "UL Service Account"
|
||||
git config user.email "hello-happy-puppy@users.noreply.github.com"
|
||||
- name: Add CODEOWNERS file
|
||||
run: |
|
||||
echo "@uniswap/web-reviewers" > CODEOWNERS
|
||||
git add CODEOWNERS
|
||||
git commit -m "ci: add CODEOWNERS file"
|
||||
- uses: peter-evans/create-pull-request@ea54357f43e3d1cf1125471d0814f4d02cc0d364
|
||||
id: create-pull-request
|
||||
with:
|
||||
token: ${{ secrets.RELEASE_SERVICE_ACCESS_TOKEN }}
|
||||
base: 'releases/prod'
|
||||
title: 'ci: promotes staging to prod'
|
||||
delete-branch: 'true'
|
||||
committer: 'UL Service Account <hello-happy-puppy@users.noreply.github.com>'
|
||||
author: 'UL Service Account <hello-happy-puppy@users.noreply.github.com>'
|
||||
branch: 'approvals/staging-to-prod'
|
||||
- name: Update PR body
|
||||
env:
|
||||
GH_TOKEN: ${{ github.token }}
|
||||
run: |
|
||||
echo "### Description" > /tmp/pr_desc
|
||||
echo "" >> /tmp/pr_desc
|
||||
echo "This PR promotes the following commits from `releases/staging` to `releases/prod`." >> /tmp/pr_desc
|
||||
echo "" >> /tmp/pr_desc
|
||||
gh pr view ${{ steps.create-pull-request.outputs.pull-request-number }} --json commits | jq '.commits[] | [.oid, .messageHeadline] | @tsv' | sed 's/"//g' | sed 's/\\t/ - /g' >> /tmp/pr_desc
|
||||
echo "" >> /tmp/pr_desc
|
||||
echo "**Once approved this PR will be automatically merged via a merge commit.**" >> /tmp/pr_desc
|
||||
gh pr edit ${{ steps.create-pull-request.outputs.pull-request-number }} -b "$(cat /tmp/pr_desc)"
|
||||
- name: Enable PR automerge
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.RELEASE_SERVICE_ACCESS_TOKEN }}
|
||||
run: gh pr merge --delete-branch --merge --auto "${{ steps.create-pull-request.outputs.pull-request-number }}"
|
||||
git push origin releases/staging:releases/prod --force
|
||||
|
6
.github/workflows/4-deploy-to-prod.yml
vendored
6
.github/workflows/4-deploy-to-prod.yml
vendored
@ -1,4 +1,4 @@
|
||||
name: 4 | Deploy to prod
|
||||
name: 4 | Deploy prod
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
@ -6,8 +6,9 @@ on:
|
||||
|
||||
jobs:
|
||||
deploy-to-prod:
|
||||
runs-on: ubuntu-latest
|
||||
environment:
|
||||
name: prod
|
||||
name: deploy/prod
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: ./.github/actions/setup
|
||||
@ -88,4 +89,3 @@ jobs:
|
||||
environment: production
|
||||
sourcemaps: './build/static/js'
|
||||
url_prefix: '~/static/js'
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user