Merge pull request #30923 from allroundexperts/fix-30871 #2115
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: Deploy code to staging or production | |
on: | |
push: | |
branches: [staging, production] | |
jobs: | |
deployStaging: | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/staging' | |
steps: | |
- name: Checkout staging branch | |
uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 | |
with: | |
ref: staging | |
token: ${{ secrets.OS_BOTIFY_TOKEN }} | |
- uses: Expensify/App/.github/actions/composite/setupGitForOSBotifyApp@8c19d6da4a3d7ce3b15c9cd89a802187d208ecab | |
id: setupGitForOSBotify | |
with: | |
GPG_PASSPHRASE: ${{ secrets.LARGE_SECRET_PASSPHRASE }} | |
OS_BOTIFY_APP_ID: ${{ secrets.OS_BOTIFY_APP_ID }} | |
OS_BOTIFY_PRIVATE_KEY: ${{ secrets.OS_BOTIFY_PRIVATE_KEY }} | |
- name: Tag version | |
run: git tag "$(npm run print-version --silent)" | |
- name: 🚀 Push tags to trigger staging deploy 🚀 | |
run: git push --tags | |
deployProduction: | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/production' | |
steps: | |
- uses: actions/checkout@v3 | |
name: Checkout | |
with: | |
ref: production | |
token: ${{ secrets.OS_BOTIFY_TOKEN }} | |
- uses: Expensify/App/.github/actions/composite/setupGitForOSBotifyApp@8c19d6da4a3d7ce3b15c9cd89a802187d208ecab | |
id: setupGitForOSBotify | |
with: | |
GPG_PASSPHRASE: ${{ secrets.LARGE_SECRET_PASSPHRASE }} | |
OS_BOTIFY_APP_ID: ${{ secrets.OS_BOTIFY_APP_ID }} | |
OS_BOTIFY_PRIVATE_KEY: ${{ secrets.OS_BOTIFY_PRIVATE_KEY }} | |
- name: Get current app version | |
run: echo "PRODUCTION_VERSION=$(npm run print-version --silent)" >> "$GITHUB_ENV" | |
- name: Get Release Pull Request List | |
id: getReleasePRList | |
uses: Expensify/App/.github/actions/javascript/getDeployPullRequestList@main | |
with: | |
TAG: ${{ env.PRODUCTION_VERSION }} | |
GITHUB_TOKEN: ${{ steps.setupGitForOSBotify.outputs.OS_BOTIFY_API_TOKEN }} | |
IS_PRODUCTION_DEPLOY: true | |
- name: Generate Release Body | |
id: getReleaseBody | |
uses: Expensify/App/.github/actions/javascript/getReleaseBody@main | |
with: | |
PR_LIST: ${{ steps.getReleasePRList.outputs.PR_LIST }} | |
- name: 🚀 Create release to trigger production deploy 🚀 | |
uses: softprops/action-gh-release@affa18ef97bc9db20076945705aba8c516139abd | |
with: | |
tag_name: ${{ env.PRODUCTION_VERSION }} | |
body: ${{ steps.getReleaseBody.outputs.RELEASE_BODY }} | |
env: | |
GITHUB_TOKEN: ${{ steps.setupGitForOSBotify.outputs.OS_BOTIFY_API_TOKEN }} |