Skip to content

Commit

Permalink
fix(stacks.web): use temp dir for web clone, remove duplicate clone, …
Browse files Browse the repository at this point in the history
…per-env concurrency

Signed-off-by: Braden Mars <bradenmars@bradenmars.me>
  • Loading branch information
BradenM committed Sep 23, 2023
1 parent 8063cc8 commit 99765cb
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 33 deletions.
23 changes: 9 additions & 14 deletions .github/workflows/deploy-crisiscleanup-site.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
VITE_APP_GOOGLE_MAPS_API_KEY: ${{secrets.VITE_APP_GOOGLE_MAPS_API_KEY}}
SENTRY_DSN: ${{secrets.SENTRY_DSN}}
CCU_CONFIGS_DECRYPT: "true"
CCU_WEB_SITE_SOURCE: ${{github.workspace}}/.crisiscleanup-4-web/dist
CCU_WEB_SITE_SOURCE: ${{runner.temp}}/.crisiscleanup-4-web/dist
steps:
- name: Mask values
run: |-
Expand Down Expand Up @@ -80,18 +80,6 @@ jobs:
uses: azure/setup-helm@v3
with:
version: 3.12.2
- name: Checkout
uses: actions/checkout@v3
with:
ref: master
repository: CrisisCleanup/crisiscleanup-4-web
path: .crisiscleanup-4-web
- name: Install Web
working-directory: .crisiscleanup-4-web
run: pnpm install
- name: Build Web
working-directory: .crisiscleanup-4-web
run: pnpm build:app
- name: Authenticate Via OIDC Role
uses: aws-actions/configure-aws-credentials@v1-node16
with:
Expand All @@ -111,6 +99,13 @@ jobs:
with:
ref: master
repository: CrisisCleanup/crisiscleanup-4-web
path: ${{runner.temp}}/.crisiscleanup-4-web
- name: Install Web
working-directory: ${{runner.temp}}/.crisiscleanup-4-web
run: pnpm install
- name: Build Web
working-directory: ${{runner.temp}}/.crisiscleanup-4-web
run: pnpm build:app
- name: Install
run: pnpm install
- name: Build
Expand Down Expand Up @@ -331,5 +326,5 @@ jobs:
no-fail-on-empty-changeset: "1"
role-arn: arn:aws:iam::${{secrets.AWS_ACCOUNT_ID_PRODUCTION}}:role/cdk-hnb659fds-cfn-exec-role-${{secrets.AWS_ACCOUNT_ID_PRODUCTION}}-us-east-1
concurrency:
group: deploy-web
group: deploy-web-${{inputs.environment}}
cancel-in-progress: false
39 changes: 20 additions & 19 deletions packages/stacks/web/src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ class CrisisCleanupWebStage extends GitHubStage {
}
}

const webRoot =
interpolateValue(ActionsContext.RUNNER, 'temp') + '/.crisiscleanup-4-web'
const webDist = webRoot + '/dist'
const pipeline = GithubCodePipeline.create({
rootDir: cwd!,
assetsS3Bucket: 'crisiscleanup-pipeline-assets',
Expand All @@ -59,10 +62,6 @@ const pipeline = GithubCodePipeline.create({
})
.addConfigsEnv()
.addNxEnv()
.synthCheckout({
ref: 'master',
repository: 'CrisisCleanup/crisiscleanup-4-web',
})
.addSynthEnv({
...interpolateObject(
ActionsContext.VARS,
Expand Down Expand Up @@ -91,32 +90,30 @@ const pipeline = GithubCodePipeline.create({
'SENTRY_DSN',
),
CCU_CONFIGS_DECRYPT: 'true',
CCU_WEB_SITE_SOURCE:
interpolateValue(ActionsContext.GITHUB, 'workspace') +
'/.crisiscleanup-4-web/dist',
})
.synthTarget({
packageName: 'stacks.web',
workingDirectory: 'packages/stacks/web',
environment: {
name: interpolateValue(ActionsContext.INPUTS, 'environment'),
url: interpolateValue(ActionsContext.VARS, 'VITE_APP_BASE_URL'),
},
CCU_WEB_SITE_SOURCE: webDist,
})
.synthPreStep({
name: 'Build Web',
workingDirectory: '.crisiscleanup-4-web',
workingDirectory: webRoot,
run: 'pnpm build:app',
})
.synthPreStep({
name: 'Install Web',
workingDirectory: '.crisiscleanup-4-web',
workingDirectory: webRoot,
run: 'pnpm install',
})
.synthCheckout({
ref: 'master',
repository: 'CrisisCleanup/crisiscleanup-4-web',
path: '.crisiscleanup-4-web',
path: webRoot,
})
.synthTarget({
packageName: 'stacks.web',
workingDirectory: 'packages/stacks/web',
environment: {
name: interpolateValue(ActionsContext.INPUTS, 'environment'),
url: interpolateValue(ActionsContext.VARS, 'VITE_APP_BASE_URL'),
},
})
.defaultTools()
.clone({
Expand All @@ -130,7 +127,11 @@ const pipeline = GithubCodePipeline.create({
default: 'development',
},
})
.concurrency({ group: 'deploy-web', cancelInProgress: false })
.concurrency({
group:
'deploy-web-' + interpolateValue(ActionsContext.INPUTS, 'environment'),
cancelInProgress: false,
})

pipeline.addStageWithGitHubOptions(
new CrisisCleanupWebStage(
Expand Down

0 comments on commit 99765cb

Please sign in to comment.