Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[No QA] Create callable worklow for createNewVersion #9812

Merged
merged 20 commits into from
Jul 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 2 additions & 29 deletions .github/workflows/cherryPick.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,36 +26,9 @@ jobs:

createNewVersion:
needs: validateActor
runs-on: ubuntu-latest
if: ${{ fromJSON(needs.validateActor.outputs.IS_DEPLOYER) && github.event.inputs.NEW_VERSION == '' }}
outputs:
NEW_VERSION: ${{ steps.getNewVersion.outputs.NEW_VERSION }}
steps:
- name: Checkout main branch
uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
with:
ref: main
token: ${{ secrets.OS_BOTIFY_TOKEN }}

- uses: softprops/turnstyle@8db075d65b19bf94e6e8687b504db69938dc3c65
with:
poll-interval-seconds: 10
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Create new BUILD version
uses: Expensify/App/.github/actions/javascript/triggerWorkflowAndWait@main
with:
GITHUB_TOKEN: ${{ secrets.OS_BOTIFY_TOKEN }}
WORKFLOW: createNewVersion.yml
INPUTS: '{ "SEMVER_LEVEL": "BUILD" }'

- name: Pull main to get the new version
id: getNewVersion
run: |
git pull origin main
echo "New version is $(npm run print-version --silent)"
echo "::set-output name=NEW_VERSION::$(npm run print-version --silent)"
uses: Expensify/App/.github/workflows/createNewVersion.yml@main
secrets: inherit

cherryPick:
needs: [validateActor, createNewVersion]
Expand Down
48 changes: 34 additions & 14 deletions .github/workflows/createNewVersion.yml
Original file line number Diff line number Diff line change
@@ -1,47 +1,67 @@
name: Create a new version
name: Create new version

on:
workflow_dispatch:
workflow_call:
inputs:
SEMVER_LEVEL:
description: One of {BUILD, PATCH, MINOR, MAJOR}
required: false
default: BUILD
type: string

outputs:
NEW_VERSION:
description: The new version string
value: ${{ jobs.createNewVersion.outputs.NEW_VERSION }}

secrets:
LARGE_SECRET_PASSPHRASE:
description: Passphrase used to decrypt GPG key
required: true
OS_BOTIFY_TOKEN:
description: Token for the OSBotify user
required: true
SLACK_WEBHOOK:
description: Webhook used to comment in slack
required: true

jobs:
createNewVersion:
if: github.actor == 'OSBotify'
runs-on: macos-11
runs-on: macos-latest

outputs:
NEW_VERSION: ${{ steps.bumpVersion.outputs.NEW_VERSION }}

steps:
# Version: 2.3.4
- uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
# Version: 3.0.2
- uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b
with:
fetch-depth: 0
token: ${{ secrets.OS_BOTIFY_TOKEN }}

- uses: softprops/turnstyle@8db075d65b19bf94e6e8687b504db69938dc3c65
with:
poll-interval-seconds: 10
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- uses: Expensify/App/.github/actions/composite/setupGitForOSBotify@main
with:
GPG_PASSPHRASE: ${{ secrets.LARGE_SECRET_PASSPHRASE }}

- name: Create new branch
run: |
BRANCH_NAME="version-${{ github.event.inputs.SEMVER_LEVEL }}-$(uuidgen)"
BRANCH_NAME="version-${{ inputs.SEMVER_LEVEL }}-$(uuidgen)"
git checkout -b "$BRANCH_NAME"
git push --set-upstream origin "$BRANCH_NAME"
echo "VERSION_BRANCH=$BRANCH_NAME" >> "$GITHUB_ENV"

- uses: softprops/turnstyle@8db075d65b19bf94e6e8687b504db69938dc3c65
with:
poll-interval-seconds: 10
env:
GITHUB_TOKEN: ${{ github.token }}

- name: Generate version
id: bumpVersion
uses: Expensify/App/.github/actions/javascript/bumpVersion@main
with:
GITHUB_TOKEN: ${{ secrets.OS_BOTIFY_TOKEN }}
SEMVER_LEVEL: ${{ github.event.inputs.SEMVER_LEVEL }}
SEMVER_LEVEL: ${{ inputs.SEMVER_LEVEL }}

- name: Commit new version
run: |
Expand Down
50 changes: 13 additions & 37 deletions .github/workflows/finishReleaseCycle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,70 +56,46 @@ jobs:
needs: validate
if: ${{ fromJSON(needs.validate.outputs.isValid) }}
steps:
- uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
with:
ref: main
token: ${{ secrets.OS_BOTIFY_TOKEN }}

- name: Update production branch
uses: Expensify/App/.github/actions/composite/updateProtectedBranch@main
with:
TARGET_BRANCH: production
OS_BOTIFY_TOKEN: ${{ secrets.OS_BOTIFY_TOKEN }}
GPG_PASSPHRASE: ${{ secrets.LARGE_SECRET_PASSPHRASE }}

# Deploy deferred PRs to staging and create a new StagingDeployCash for the next release cycle.
createNewStagingDeployCash:
runs-on: macos-11
# Create a new patch version to prep for next release cycle
createNewPatchVersion:
needs: validate
if: ${{ fromJSON(needs.validate.outputs.isValid) }}
steps:
# Version: 2.3.4
- uses: actions/checkout@5a4ac9002d0be2fb38bd78e4b4dbde5606d7042f
with:
ref: main
fetch-depth: 0
token: ${{ secrets.OS_BOTIFY_TOKEN }}

- uses: softprops/turnstyle@8db075d65b19bf94e6e8687b504db69938dc3c65
with:
poll-interval-seconds: 10
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Create new PATCH version
uses: Expensify/App/.github/actions/javascript/triggerWorkflowAndWait@main
with:
GITHUB_TOKEN: ${{ secrets.OS_BOTIFY_TOKEN }}
WORKFLOW: createNewVersion.yml
INPUTS: '{ "SEMVER_LEVEL": "PATCH" }'
uses: Expensify/App/.github/workflows/createNewVersion.yml@main
secrets: inherit
with:
SEMVER_LEVEL: PATCH

# Deploy deferred PRs to staging and create a new StagingDeployCash for the next release cycle.
createNewStagingDeployCash:
runs-on: ubuntu-latest
needs: createNewPatchVersion
steps:
- name: Update staging branch to trigger staging deploy
uses: Expensify/App/.github/actions/composite/updateProtectedBranch@main
with:
TARGET_BRANCH: staging
OS_BOTIFY_TOKEN: ${{ secrets.OS_BOTIFY_TOKEN }}
GPG_PASSPHRASE: ${{ secrets.LARGE_SECRET_PASSPHRASE }}

- name: Pull staging to get the new version
run: |
git checkout staging
git pull origin staging
echo "NEW_VERSION=$(npm run print-version --silent)" >> "$GITHUB_ENV"
echo "New version is ${{ env.NEW_VERSION }}"

# Create a local git tag so that GitUtils.getPullRequestsMergedBetween can use `git log` to generate a
# list of pull requests that were merged between this version tag and another.
# NOTE: This tag is only used locally and shouldn't be pushed to the remote.
# If it was pushed, that would trigger the staging deploy which is handled in a separate workflow (deploy.yml)
- name: Tag version
run: git tag ${{ env.NEW_VERSION }}
run: git tag ${{ needs.createNewPatchVersion.outputs.NEW_VERSION }}

- name: Create new StagingDeployCash
uses: Expensify/App/.github/actions/javascript/createOrUpdateStagingDeploy@main
with:
GITHUB_TOKEN: ${{ secrets.OS_BOTIFY_TOKEN }}
NPM_VERSION: ${{ env.NEW_VERSION }}
NPM_VERSION: ${{ needs.createNewPatchVersion.outputs.NEW_VERSION }}

- if: ${{ failure() }}
uses: Expensify/App/.github/actions/composite/announceFailedWorkflowInSlack@main
Expand Down
Loading