Skip to content

Commit

Permalink
Merge pull request Expensify#1858 from Expensify/Rory-productionDeplo…
Browse files Browse the repository at this point in the history
…yCash

Create finishReleaseCycle workflow
  • Loading branch information
AndrewGable authored Mar 18, 2021
2 parents fa6185b + c883a1b commit 15957ab
Show file tree
Hide file tree
Showing 2 changed files with 106 additions and 1 deletion.
105 changes: 105 additions & 0 deletions .github/workflows/finishReleaseCycle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
name: Prepare production deploy

on:
issues:
types: [closed]

jobs:
# This job is executed when a StagingDeployCash is closed.
# It updates the production branch to trigger the production deploy,
# and creates a new StagingDeployCash for the next release cycle.
updateProduction:
runs-on: ubuntu-latest

# Note: Anyone with Triage access to the Expensify.cash repo can trigger a production deploy
if: contains(github.event.issue.labels.*.name, 'StagingDeployCash')
steps:
- uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
with:
ref: staging
fetch-depth: 0
token: ${{ secrets.OS_BOTIFY_TOKEN }}

- name: Set up git config
run: git config user.name OSBotify

- name: Set new version for production branch
run: echo "PRODUCTION_VERSION=$(npm run print-version --silent)" >> $GITHUB_ENV

- name: Create Pull Request (production)
# Version: 2.4.3
uses: repo-sync/pull-request@33777245b1aace1a58c87a29c90321aa7a74bd7d
with:
source_branch: staging
destination_branch: production
pr_label: automerge
github_token: ${{ secrets.OS_BOTIFY_TOKEN }}
pr_title: Update version to ${{ env.PRODUCTION_VERSION }} on staging
pr_body: Update version to ${{ env.PRODUCTION_VERSION }}

- name: Create a new branch off master
run: |
git checkout master
git checkout -b version-bump-${{ github.sha }}
git push --set-upstream origin version-bump-${{ github.sha }}
- name: Generate a new version
id: bumpVersion
uses: Expensify/Expensify.cash/.github/actions/bumpVersion@master
with:
GITHUB_TOKEN: ${{ secrets.OS_BOTIFY_TOKEN }}

- name: Commit new version
run: |
git add \
./package.json \
./package-lock.json \
./android/app/build.gradle \
./ios/ExpensifyCash/Info.plist \
./ios/ExpensifyCashTests/Info.plist
git commit -m "Update version to ${{ steps.bumpVersion.outputs.NEW_VERSION }}"
- name: Create Pull Request (master)
uses: peter-evans/create-pull-request@09b9ac155b0d5ad7d8d157ed32158c1b73689109
with:
token: ${{ secrets.OS_BOTIFY_TOKEN }}
author: OSBotify <[email protected]>
base: master
branch: version-bump-${{ github.sha }}
title: Update version to ${{ steps.bumpVersion.outputs.NEW_VERSION }} on master
body: Update version to ${{ steps.bumpVersion.outputs.NEW_VERSION }}
labels: automerge

#TODO: Once we add cherry picking, we will need run this from elsewhere
- name: Tag version
run: git tag ${{ steps.bumpVersion.outputs.NEW_VERSION }}

- name: 🚀 Push tags to trigger staging deploy 🚀
run: git push --tags

- name: Create new StagingDeployCash
uses: Expensify/Expensify.cash/.github/actions/createOrUpdateStagingDeploy@master
with:
GITHUB_TOKEN: ${{ secrets.OS_BOTIFY_TOKEN }}
NPM_VERSION: ${{ steps.bumpVersion.outputs.NEW_VERSION }}

# This Slack step is duplicated in all workflows, if you make a change to this step, make sure to update all
# the other workflows with the same change
- uses: 8398a7/action-slack@v3
name: Job failed Slack notification
if: ${{ failure() }}
with:
status: custom
fields: workflow, repo
custom_payload: |
{
channel: '#announce',
attachments: [{
color: "#DB4545",
pretext: `<!here>`,
text: `💥 ${process.env.AS_REPO} failed on ${process.env.AS_WORKFLOW} workflow 💥`,
}]
}
env:
GITHUB_TOKEN: ${{ github.token }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }}
2 changes: 1 addition & 1 deletion .github/workflows/preDeploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ jobs:
- name: Set Staging Version
run: echo "STAGING_VERSION=$(npm run print-version --silent)" >> $GITHUB_ENV

- name: Create Pull Request
- name: Create Pull Request (staging)
# Version: 2.4.3
uses: repo-sync/pull-request@33777245b1aace1a58c87a29c90321aa7a74bd7d
with:
Expand Down

0 comments on commit 15957ab

Please sign in to comment.