From d3cbce1aeef125239e3152939bc70dd4ffe13da0 Mon Sep 17 00:00:00 2001 From: rory Date: Wed, 11 Sep 2024 10:54:40 -0700 Subject: [PATCH 1/7] Add --clobber flag for gh release upload --- .github/workflows/deploy.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index ea67b6d96256..ab3d3e12e2dc 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -511,7 +511,7 @@ jobs: - name: Upload artifacts to GitHub Release run: | - gh release upload ${{ needs.prep.outputs.APP_VERSION }} --repo ${{ github.repository }} \ + gh release upload ${{ needs.prep.outputs.APP_VERSION }} --repo ${{ github.repository }} --clobber \ ./android-sourcemaps-artifact/index.android.bundle.map#android-sourcemap-${{ needs.prep.outputs.APP_VERSION }} \ ./android-build-artifact/app-production-release.aab \ ./desktop-sourcemaps-artifact/desktop-merged-source-map.js.map#desktop-sourcemap-${{ needs.prep.outputs.APP_VERSION }} \ @@ -557,7 +557,7 @@ jobs: - name: Upload artifacts to GitHub Release run: | - gh release upload ${{ needs.prep.outputs.APP_VERSION }} --repo ${{ github.repository }} \ + gh release upload ${{ needs.prep.outputs.APP_VERSION }} --repo ${{ github.repository }} --clobber \ ./desktop-sourcemaps-artifact/desktop-merged-source-map.js.map#desktop-sourcemap-${{ needs.prep.outputs.APP_VERSION }} \ ./desktop-build-artifact/NewExpensify.dmg \ ./web-sourcemaps-artifact/web-merged-source-map.js.map#web-sourcemap-${{ needs.prep.outputs.APP_VERSION }} \ From b86b0d1e6666c1c297e735a0ef6bc82b209c0b86 Mon Sep 17 00:00:00 2001 From: rory Date: Wed, 11 Sep 2024 11:16:05 -0700 Subject: [PATCH 2/7] Give staging artifacts a different name --- .github/workflows/deploy.yml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index ab3d3e12e2dc..29a6a027d83f 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -198,13 +198,13 @@ jobs: - name: Upload desktop sourcemaps artifact uses: actions/upload-artifact@v4 with: - name: desktop-sourcemaps-artifact + name: ${{ env.SHOULD_DEPLOY_PRODUCTION && 'desktop-sourcemaps-artifact' || 'desktop-staging-sourcemaps-artifact' }} path: ./desktop/dist/www/merged-source-map.js.map - name: Upload desktop build artifact uses: actions/upload-artifact@v4 with: - name: desktop-build-artifact + name: ${{ env.SHOULD_DEPLOY_PRODUCTION && 'desktop-build-artifact' || 'desktop-staging-build-artifact' }} path: ./desktop-build/NewExpensify.dmg iOS: @@ -411,7 +411,7 @@ jobs: - name: Upload web sourcemaps artifact uses: actions/upload-artifact@v4 with: - name: web-sourcemaps-artifact + name: ${{ env.SHOULD_DEPLOY_PRODUCTION && 'web' || 'web-staging' }}-sourcemaps-artifact path: ./dist/merged-source-map.js.map - name: Compress web build .tar.gz and .zip @@ -422,13 +422,13 @@ jobs: - name: Upload .tar.gz web build artifact uses: actions/upload-artifact@v4 with: - name: web-build-tar-gz-artifact + name: ${{ env.SHOULD_DEPLOY_PRODUCTION && 'web' || 'web-staging' }}-build-tar-gz-artifact path: ./webBuild.tar.gz - name: Upload .zip web build artifact uses: actions/upload-artifact@v4 with: - name: web-build-zip-artifact + name: ${{ env.SHOULD_DEPLOY_PRODUCTION && 'web' || 'web-staging' }}-build-zip-artifact path: ./webBuild.zip postSlackMessageOnFailure: @@ -506,21 +506,21 @@ jobs: - name: Rename web and desktop sourcemaps artifacts before assets upload in order to have unique ReleaseAsset.name run: | - mv ./desktop-sourcemaps-artifact/merged-source-map.js.map ./desktop-sourcemaps-artifact/desktop-merged-source-map.js.map - mv ./web-sourcemaps-artifact/merged-source-map.js.map ./web-sourcemaps-artifact/web-merged-source-map.js.map + mv ./desktop-staging-sourcemaps-artifact/merged-source-map.js.map ./desktop-staging-sourcemaps-artifact/desktop-staging-merged-source-map.js.map + mv ./web-staging-sourcemaps-artifact/merged-source-map.js.map ./web-staging-sourcemaps-artifact/web-staging-merged-source-map.js.map - name: Upload artifacts to GitHub Release run: | gh release upload ${{ needs.prep.outputs.APP_VERSION }} --repo ${{ github.repository }} --clobber \ ./android-sourcemaps-artifact/index.android.bundle.map#android-sourcemap-${{ needs.prep.outputs.APP_VERSION }} \ ./android-build-artifact/app-production-release.aab \ - ./desktop-sourcemaps-artifact/desktop-merged-source-map.js.map#desktop-sourcemap-${{ needs.prep.outputs.APP_VERSION }} \ - ./desktop-build-artifact/NewExpensify.dmg \ + ./desktop-staging-sourcemaps-artifact/desktop-staging-merged-source-map.js.map#desktop-staging-sourcemap-${{ needs.prep.outputs.APP_VERSION }} \ + ./desktop-staging-build-artifact/NewExpensify.dmg#NewExpensifyStaging.dmg \ ./ios-sourcemaps-artifact/main.jsbundle.map#ios-sourcemap-${{ needs.prep.outputs.APP_VERSION }} \ ./ios-build-artifact/New\ Expensify.ipa \ - ./web-sourcemaps-artifact/web-merged-source-map.js.map#web-sourcemap-${{ needs.prep.outputs.APP_VERSION }} \ - ./web-build-tar-gz-artifact/webBuild.tar.gz \ - ./web-build-zip-artifact/webBuild.zip + ./web-staging-sourcemaps-artifact/web-staging-merged-source-map.js.map#web-staging-sourcemap-${{ needs.prep.outputs.APP_VERSION }} \ + ./web-staging-build-tar-gz-artifact/webBuild.tar.gz#stagingWebBuild.tar.gz \ + ./web-staging-build-zip-artifact/webBuild.zip#stagingWebBuild.zip env: GITHUB_TOKEN: ${{ github.token }} From c6901e6d63bc57497f42d16ff76979a7a8bb9633 Mon Sep 17 00:00:00 2001 From: rory Date: Wed, 11 Sep 2024 11:58:23 -0700 Subject: [PATCH 3/7] Update getDeployPullRequestList to look only at releases, not workflow runs --- .../getDeployPullRequestList.ts | 165 +++++------------- .../getDeployPullRequestList/index.js | 127 ++++---------- 2 files changed, 77 insertions(+), 215 deletions(-) diff --git a/.github/actions/javascript/getDeployPullRequestList/getDeployPullRequestList.ts b/.github/actions/javascript/getDeployPullRequestList/getDeployPullRequestList.ts index 5d5dbc7e2f29..5f2e0770310b 100644 --- a/.github/actions/javascript/getDeployPullRequestList/getDeployPullRequestList.ts +++ b/.github/actions/javascript/getDeployPullRequestList/getDeployPullRequestList.ts @@ -1,79 +1,9 @@ import * as core from '@actions/core'; import * as github from '@actions/github'; -import type {RestEndpointMethodTypes} from '@octokit/plugin-rest-endpoint-methods/dist-types/generated/parameters-and-response-types'; import {getJSONInput} from '@github/libs/ActionUtils'; import GithubUtils from '@github/libs/GithubUtils'; import GitUtils from '@github/libs/GitUtils'; -type WorkflowRun = RestEndpointMethodTypes['actions']['listWorkflowRuns']['response']['data']['workflow_runs'][number]; - -const BUILD_AND_DEPLOY_JOB_NAME_PREFIX = 'Build and deploy'; - -/** - * This function checks if a given release is a valid baseTag to get the PR list with `git log baseTag...endTag`. - * - * The rules are: - * - production deploys can only be compared with other production deploys - * - staging deploys can be compared with other staging deploys or production deploys. - * The reason is that the final staging release in each deploy cycle will BECOME a production release. - * For example, imagine a checklist is closed with version 9.0.20-6; that's the most recent staging deploy, but the release for 9.0.20-6 is now finalized, so it looks like a prod deploy. - * When 9.0.21-0 finishes deploying to staging, the most recent prerelease is 9.0.20-5. However, we want 9.0.20-6...9.0.21-0, - * NOT 9.0.20-5...9.0.21-0 (so that the PR CP'd in 9.0.20-6 is not included in the next checklist) - */ -async function isReleaseValidBaseForEnvironment(releaseTag: string, isProductionDeploy: boolean) { - if (!isProductionDeploy) { - return true; - } - const isPrerelease = ( - await GithubUtils.octokit.repos.getReleaseByTag({ - owner: github.context.repo.owner, - repo: github.context.repo.repo, - tag: releaseTag, - }) - ).data.prerelease; - return !isPrerelease; -} - -/** - * Was a given deploy workflow run successful on at least one platform? - */ -async function wasDeploySuccessful(runID: number) { - const jobsForWorkflowRun = ( - await GithubUtils.octokit.actions.listJobsForWorkflowRun({ - owner: github.context.repo.owner, - repo: github.context.repo.repo, - // eslint-disable-next-line @typescript-eslint/naming-convention - run_id: runID, - filter: 'latest', - }) - ).data.jobs; - return jobsForWorkflowRun.some((job) => job.name.startsWith(BUILD_AND_DEPLOY_JOB_NAME_PREFIX) && job.conclusion === 'success'); -} - -/** - * This function checks if a given deploy workflow is a valid basis for comparison when listing PRs merged between two versions. - * It returns the reason a version should be skipped, or an empty string if the version should not be skipped. - */ -async function shouldSkipVersion(lastSuccessfulDeploy: WorkflowRun, inputTag: string, isProductionDeploy: boolean): Promise { - if (!lastSuccessfulDeploy?.head_branch) { - // This should never happen. Just doing this to appease TS. - return ''; - } - - // we never want to compare a tag with itself. This check is necessary because prod deploys almost always have the same version as the last staging deploy. - // In this case, the next for wrong environment fails because the release that triggered that staging deploy is now finalized, so it looks like a prod deploy. - if (lastSuccessfulDeploy?.head_branch === inputTag) { - return `Same as input tag ${inputTag}`; - } - if (!(await isReleaseValidBaseForEnvironment(lastSuccessfulDeploy?.head_branch, isProductionDeploy))) { - return 'Was a staging deploy, we only want to compare with other production deploys'; - } - if (!(await wasDeploySuccessful(lastSuccessfulDeploy.id))) { - return 'Was an unsuccessful deploy, nothing was deployed in that version'; - } - return ''; -} - async function run() { try { const inputTag = core.getInput('TAG', {required: true}); @@ -82,62 +12,55 @@ async function run() { console.log(`Looking for PRs deployed to ${deployEnv} in ${inputTag}...`); - const platformDeploys = ( - await GithubUtils.octokit.actions.listWorkflowRuns({ - owner: github.context.repo.owner, - repo: github.context.repo.repo, - // eslint-disable-next-line @typescript-eslint/naming-convention - workflow_id: 'platformDeploy.yml', - status: 'completed', - }) - ).data.workflow_runs - // Note: we filter out cancelled runs instead of looking only for success runs - // because if a build fails on even one platform, then it will have the status 'failure' - .filter((workflowRun) => workflowRun.conclusion !== 'cancelled'); - - const deploys = ( - await GithubUtils.octokit.actions.listWorkflowRuns({ + let priorTag: string | undefined; + let foundCurrentRelease = false; + await GithubUtils.paginate( + GithubUtils.octokit.repos.listReleases, + { owner: github.context.repo.owner, repo: github.context.repo.repo, - // eslint-disable-next-line @typescript-eslint/naming-convention - workflow_id: 'deploy.yml', - status: 'completed', - }) - ).data.workflow_runs - // Note: we filter out cancelled runs instead of looking only for success runs - // because if a build fails on even one platform, then it will have the status 'failure' - .filter((workflowRun) => workflowRun.conclusion !== 'cancelled'); - - // W've combined platformDeploy.yml and deploy.yml - // TODO: Remove this once there are successful staging and production deploys using the new deploy.yml workflow - const completedDeploys = [...deploys, ...platformDeploys]; - completedDeploys.sort((a, b) => new Date(b.created_at).getTime() - new Date(a.created_at).getTime()); - - // Find the most recent deploy workflow targeting the correct environment, for which at least one of the build jobs finished successfully - let lastSuccessfulDeploy = completedDeploys.shift(); - - if (!lastSuccessfulDeploy) { - throw new Error('Could not find a prior successful deploy'); - } - - let reason = await shouldSkipVersion(lastSuccessfulDeploy, inputTag, isProductionDeploy); - while (lastSuccessfulDeploy && reason) { - console.log( - `Deploy of tag ${lastSuccessfulDeploy.head_branch} was not valid as a base for comparison, looking at the next one. Reason: ${reason}`, - lastSuccessfulDeploy.html_url, - ); - lastSuccessfulDeploy = completedDeploys.shift(); - - if (!lastSuccessfulDeploy) { - throw new Error('Could not find a prior successful deploy'); - } - - reason = await shouldSkipVersion(lastSuccessfulDeploy, inputTag, isProductionDeploy); + per_page: 100, + }, + ({data}, done) => { + // For production deploys, look only at other production deploys. + // staging deploys can be compared with other staging deploys or production deploys. + // The reason is that the final staging release in each deploy cycle will BECOME a production release + const filteredData = isProductionDeploy ? data.filter((release) => !release.prerelease) : data; + + // Release was in the last page, meaning the previous release is the first item in this page + if (foundCurrentRelease) { + priorTag = data.at(0)?.tag_name; + done(); + return filteredData; + } + + // Search for the index of input tag + const indexOfCurrentRelease = filteredData.findIndex((release) => release.tag_name === inputTag); + + // If it happens to be at the end of this page, then the previous tag will be in the next page. + // Set a flag showing we found it so we grab the first release of the next page + if (indexOfCurrentRelease === filteredData.length - 1) { + foundCurrentRelease = true; + return filteredData; + } + + // If it's anywhere else in this page, the the prior release is the next item in the page + if (indexOfCurrentRelease > 0) { + priorTag = filteredData.at(indexOfCurrentRelease + 1)?.tag_name; + done(); + } + + // Release not in this page (or we're done) + return filteredData; + }, + ); + + if (!priorTag) { + throw new Error('Something went wrong and the prior tag could not be found.'); } - const priorTag = lastSuccessfulDeploy.head_branch; console.log(`Looking for PRs deployed to ${deployEnv} between ${priorTag} and ${inputTag}`); - const prList = await GitUtils.getPullRequestsMergedBetween(priorTag ?? '', inputTag); + const prList = await GitUtils.getPullRequestsMergedBetween(priorTag, inputTag); console.log('Found the pull request list: ', prList); core.setOutput('PR_LIST', prList); } catch (error) { diff --git a/.github/actions/javascript/getDeployPullRequestList/index.js b/.github/actions/javascript/getDeployPullRequestList/index.js index 3faaeb28f548..9b798b605750 100644 --- a/.github/actions/javascript/getDeployPullRequestList/index.js +++ b/.github/actions/javascript/getDeployPullRequestList/index.js @@ -11502,111 +11502,50 @@ const github = __importStar(__nccwpck_require__(5438)); const ActionUtils_1 = __nccwpck_require__(6981); const GithubUtils_1 = __importDefault(__nccwpck_require__(9296)); const GitUtils_1 = __importDefault(__nccwpck_require__(1547)); -const BUILD_AND_DEPLOY_JOB_NAME_PREFIX = 'Build and deploy'; -/** - * This function checks if a given release is a valid baseTag to get the PR list with `git log baseTag...endTag`. - * - * The rules are: - * - production deploys can only be compared with other production deploys - * - staging deploys can be compared with other staging deploys or production deploys. - * The reason is that the final staging release in each deploy cycle will BECOME a production release. - * For example, imagine a checklist is closed with version 9.0.20-6; that's the most recent staging deploy, but the release for 9.0.20-6 is now finalized, so it looks like a prod deploy. - * When 9.0.21-0 finishes deploying to staging, the most recent prerelease is 9.0.20-5. However, we want 9.0.20-6...9.0.21-0, - * NOT 9.0.20-5...9.0.21-0 (so that the PR CP'd in 9.0.20-6 is not included in the next checklist) - */ -async function isReleaseValidBaseForEnvironment(releaseTag, isProductionDeploy) { - if (!isProductionDeploy) { - return true; - } - const isPrerelease = (await GithubUtils_1.default.octokit.repos.getReleaseByTag({ - owner: github.context.repo.owner, - repo: github.context.repo.repo, - tag: releaseTag, - })).data.prerelease; - return !isPrerelease; -} -/** - * Was a given deploy workflow run successful on at least one platform? - */ -async function wasDeploySuccessful(runID) { - const jobsForWorkflowRun = (await GithubUtils_1.default.octokit.actions.listJobsForWorkflowRun({ - owner: github.context.repo.owner, - repo: github.context.repo.repo, - // eslint-disable-next-line @typescript-eslint/naming-convention - run_id: runID, - filter: 'latest', - })).data.jobs; - return jobsForWorkflowRun.some((job) => job.name.startsWith(BUILD_AND_DEPLOY_JOB_NAME_PREFIX) && job.conclusion === 'success'); -} -/** - * This function checks if a given deploy workflow is a valid basis for comparison when listing PRs merged between two versions. - * It returns the reason a version should be skipped, or an empty string if the version should not be skipped. - */ -async function shouldSkipVersion(lastSuccessfulDeploy, inputTag, isProductionDeploy) { - if (!lastSuccessfulDeploy?.head_branch) { - // This should never happen. Just doing this to appease TS. - return ''; - } - // we never want to compare a tag with itself. This check is necessary because prod deploys almost always have the same version as the last staging deploy. - // In this case, the next for wrong environment fails because the release that triggered that staging deploy is now finalized, so it looks like a prod deploy. - if (lastSuccessfulDeploy?.head_branch === inputTag) { - return `Same as input tag ${inputTag}`; - } - if (!(await isReleaseValidBaseForEnvironment(lastSuccessfulDeploy?.head_branch, isProductionDeploy))) { - return 'Was a staging deploy, we only want to compare with other production deploys'; - } - if (!(await wasDeploySuccessful(lastSuccessfulDeploy.id))) { - return 'Was an unsuccessful deploy, nothing was deployed in that version'; - } - return ''; -} async function run() { try { const inputTag = core.getInput('TAG', { required: true }); const isProductionDeploy = !!(0, ActionUtils_1.getJSONInput)('IS_PRODUCTION_DEPLOY', { required: false }, false); const deployEnv = isProductionDeploy ? 'production' : 'staging'; console.log(`Looking for PRs deployed to ${deployEnv} in ${inputTag}...`); - const platformDeploys = (await GithubUtils_1.default.octokit.actions.listWorkflowRuns({ + let priorTag; + let foundCurrentRelease = false; + await GithubUtils_1.default.paginate(GithubUtils_1.default.octokit.repos.listReleases, { owner: github.context.repo.owner, repo: github.context.repo.repo, - // eslint-disable-next-line @typescript-eslint/naming-convention - workflow_id: 'platformDeploy.yml', - status: 'completed', - })).data.workflow_runs - // Note: we filter out cancelled runs instead of looking only for success runs - // because if a build fails on even one platform, then it will have the status 'failure' - .filter((workflowRun) => workflowRun.conclusion !== 'cancelled'); - const deploys = (await GithubUtils_1.default.octokit.actions.listWorkflowRuns({ - owner: github.context.repo.owner, - repo: github.context.repo.repo, - // eslint-disable-next-line @typescript-eslint/naming-convention - workflow_id: 'deploy.yml', - status: 'completed', - })).data.workflow_runs - // Note: we filter out cancelled runs instead of looking only for success runs - // because if a build fails on even one platform, then it will have the status 'failure' - .filter((workflowRun) => workflowRun.conclusion !== 'cancelled'); - // W've combined platformDeploy.yml and deploy.yml - // TODO: Remove this once there are successful staging and production deploys using the new deploy.yml workflow - const completedDeploys = [...deploys, ...platformDeploys]; - completedDeploys.sort((a, b) => new Date(b.created_at).getTime() - new Date(a.created_at).getTime()); - // Find the most recent deploy workflow targeting the correct environment, for which at least one of the build jobs finished successfully - let lastSuccessfulDeploy = completedDeploys.shift(); - if (!lastSuccessfulDeploy) { - throw new Error('Could not find a prior successful deploy'); - } - let reason = await shouldSkipVersion(lastSuccessfulDeploy, inputTag, isProductionDeploy); - while (lastSuccessfulDeploy && reason) { - console.log(`Deploy of tag ${lastSuccessfulDeploy.head_branch} was not valid as a base for comparison, looking at the next one. Reason: ${reason}`, lastSuccessfulDeploy.html_url); - lastSuccessfulDeploy = completedDeploys.shift(); - if (!lastSuccessfulDeploy) { - throw new Error('Could not find a prior successful deploy'); + per_page: 100, + }, ({ data }, done) => { + // For production deploys, look only at other production deploys. + // staging deploys can be compared with other staging deploys or production deploys. + // The reason is that the final staging release in each deploy cycle will BECOME a production release + const filteredData = isProductionDeploy ? data.filter((release) => !release.prerelease) : data; + // Release was in the last page, meaning the previous release is the first item in this page + if (foundCurrentRelease) { + priorTag = data.at(0)?.tag_name; + done(); + return filteredData; + } + // Search for the index of input tag + const indexOfCurrentRelease = filteredData.findIndex((release) => release.tag_name === inputTag); + // If it happens to be at the end of this page, then the previous tag will be in the next page. + // Set a flag showing we found it so we grab the first release of the next page + if (indexOfCurrentRelease === filteredData.length - 1) { + foundCurrentRelease = true; + return filteredData; } - reason = await shouldSkipVersion(lastSuccessfulDeploy, inputTag, isProductionDeploy); + // If it's anywhere else in this page, the the prior release is the next item in the page + if (indexOfCurrentRelease > 0) { + priorTag = filteredData.at(indexOfCurrentRelease + 1)?.tag_name; + done(); + } + // Release not in this page (or we're done) + return filteredData; + }); + if (!priorTag) { + throw new Error('Something went wrong and the prior tag could not be found.'); } - const priorTag = lastSuccessfulDeploy.head_branch; console.log(`Looking for PRs deployed to ${deployEnv} between ${priorTag} and ${inputTag}`); - const prList = await GitUtils_1.default.getPullRequestsMergedBetween(priorTag ?? '', inputTag); + const prList = await GitUtils_1.default.getPullRequestsMergedBetween(priorTag, inputTag); console.log('Found the pull request list: ', prList); core.setOutput('PR_LIST', prList); } From 9f360ee0643ef95234f8a5400e2294cfa552f7be Mon Sep 17 00:00:00 2001 From: rory Date: Wed, 11 Sep 2024 11:59:08 -0700 Subject: [PATCH 4/7] Remove outdated warning --- .github/workflows/deploy.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 29a6a027d83f..228e3336a627 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -68,7 +68,6 @@ jobs: secrets: inherit android: - # WARNING: getDeployPullRequestList depends on this job name. do not change job name without adjusting that action accordingly name: Build and deploy Android needs: prep runs-on: ubuntu-latest-xl @@ -163,7 +162,6 @@ jobs: SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} desktop: - # WARNING: getDeployPullRequestList depends on this job name. do not change job name without adjusting that action accordingly name: Build and deploy Desktop needs: prep runs-on: macos-14-large @@ -208,7 +206,6 @@ jobs: path: ./desktop-build/NewExpensify.dmg iOS: - # WARNING: getDeployPullRequestList depends on this job name. do not change job name without adjusting that action accordingly name: Build and deploy iOS needs: prep env: @@ -334,7 +331,6 @@ jobs: SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK }} web: - # WARNING: getDeployPullRequestList depends on this job name. do not change job name without adjusting that action accordingly name: Build and deploy Web needs: prep runs-on: ubuntu-latest-xl From 4f1d36967fc00371c87ace0aa49345851dc7c191 Mon Sep 17 00:00:00 2001 From: rory Date: Wed, 11 Sep 2024 12:04:39 -0700 Subject: [PATCH 5/7] suppress naming convention lint error --- .../getDeployPullRequestList/getDeployPullRequestList.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/actions/javascript/getDeployPullRequestList/getDeployPullRequestList.ts b/.github/actions/javascript/getDeployPullRequestList/getDeployPullRequestList.ts index 5f2e0770310b..b07d29a587be 100644 --- a/.github/actions/javascript/getDeployPullRequestList/getDeployPullRequestList.ts +++ b/.github/actions/javascript/getDeployPullRequestList/getDeployPullRequestList.ts @@ -19,6 +19,7 @@ async function run() { { owner: github.context.repo.owner, repo: github.context.repo.repo, + // eslint-disable-next-line @typescript-eslint/naming-convention per_page: 100, }, ({data}, done) => { From 9fd1ccf36cb52d143c73d132ca1a4256d0cc4576 Mon Sep 17 00:00:00 2001 From: rory Date: Wed, 11 Sep 2024 12:05:00 -0700 Subject: [PATCH 6/7] Move critical release edit to happen before non-critical artifact upload --- .github/workflows/deploy.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 228e3336a627..536fef1bf220 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -551,6 +551,14 @@ jobs: mv ./desktop-sourcemaps-artifact/merged-source-map.js.map ./desktop-sourcemaps-artifact/desktop-merged-source-map.js.map mv ./web-sourcemaps-artifact/merged-source-map.js.map ./web-sourcemaps-artifact/web-merged-source-map.js.map + - name: 🚀 Edit the release to be no longer a prerelease 🚀 + run: | + LATEST_RELEASE="$(gh release list --repo ${{ github.repository }} --exclude-pre-releases --json tagName,isLatest --jq '.[] | select(.isLatest) | .tagName')" + gh api --method POST /repos/Expensify/App/releases/generate-notes -f "tag_name=${{ needs.prep.outputs.APP_VERSION }}" -f "previous_tag_name=$LATEST_RELEASE" | jq -r '.body' >> releaseNotes.md + gh release edit ${{ needs.prep.outputs.APP_VERSION }} --repo ${{ github.repository }} --prerelease=false --latest --notes-file releaseNotes.md + env: + GITHUB_TOKEN: ${{ github.token }} + - name: Upload artifacts to GitHub Release run: | gh release upload ${{ needs.prep.outputs.APP_VERSION }} --repo ${{ github.repository }} --clobber \ @@ -562,14 +570,6 @@ jobs: env: GITHUB_TOKEN: ${{ github.token }} - - name: 🚀 Edit the release to be no longer a prerelease 🚀 - run: | - LATEST_RELEASE="$(gh release list --repo ${{ github.repository }} --exclude-pre-releases --json tagName,isLatest --jq '.[] | select(.isLatest) | .tagName')" - gh api --method POST /repos/Expensify/App/releases/generate-notes -f "tag_name=${{ needs.prep.outputs.APP_VERSION }}" -f "previous_tag_name=$LATEST_RELEASE" | jq -r '.body' >> releaseNotes.md - gh release edit ${{ needs.prep.outputs.APP_VERSION }} --repo ${{ github.repository }} --prerelease=false --latest --notes-file releaseNotes.md - env: - GITHUB_TOKEN: ${{ github.token }} - - name: Warn deployers if production deploy failed if: ${{ failure() }} uses: 8398a7/action-slack@v3 From 2bc93dd97a8f5ae06d1e131a837779ec3aaacebe Mon Sep 17 00:00:00 2001 From: Carlos Martins Date: Wed, 11 Sep 2024 13:35:34 -0600 Subject: [PATCH 7/7] validate actions --- .github/actions/javascript/getDeployPullRequestList/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/actions/javascript/getDeployPullRequestList/index.js b/.github/actions/javascript/getDeployPullRequestList/index.js index 9b798b605750..0346df720b8e 100644 --- a/.github/actions/javascript/getDeployPullRequestList/index.js +++ b/.github/actions/javascript/getDeployPullRequestList/index.js @@ -11513,6 +11513,7 @@ async function run() { await GithubUtils_1.default.paginate(GithubUtils_1.default.octokit.repos.listReleases, { owner: github.context.repo.owner, repo: github.context.repo.repo, + // eslint-disable-next-line @typescript-eslint/naming-convention per_page: 100, }, ({ data }, done) => { // For production deploys, look only at other production deploys.