Skip to content

Commit e40a8ed

Browse files
committed
Run prod deploy only on version release
1 parent 4cb32a4 commit e40a8ed

File tree

5 files changed

+28
-6
lines changed

5 files changed

+28
-6
lines changed

.github/workflows/deploy-prod.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@ name: Deploy all resources to PROD
22
run-name: PROD deploy - @${{ github.actor }}
33

44
on:
5-
workflow_dispatch:
6-
push:
7-
branches:
8-
- main
5+
release:
6+
types: [created]
7+
tags:
8+
- 'v*'
9+
910
jobs:
1011
test:
1112
runs-on: ubuntu-latest
@@ -56,12 +57,17 @@ jobs:
5657
restore-keys: |
5758
yarn-modules-${{ runner.arch }}-${{ runner.os }}-
5859
60+
- name: Extract version from tag
61+
id: get_version
62+
run: echo "VITE_BUILD_HASH=${GITHUB_REF#refs/tags/v}" >> "$GITHUB_ENV"
63+
5964
- name: Run build
6065
run: make build
6166
env:
6267
HUSKY: "0"
6368
VITE_RUN_ENVIRONMENT: prod
6469
RunEnvironment: prod
70+
VITE_BUILD_HASH: ${{ env.VITE_BUILD_HASH }}
6571

6672
- name: Upload Build files
6773
uses: actions/upload-artifact@v4

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ build_swagger:
6161

6262
build: src/ cloudformation/
6363
yarn -D
64-
VITE_BUILD_HASH=$(GIT_HASH) yarn build
64+
yarn build
6565
make build_swagger
6666
cp -r src/api/resources/ dist/api/resources
6767
rm -rf dist/lambda/sqs

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ This repository is split into multiple parts:
77
## Getting Started
88
You will need node>=22 installed, as well as the AWS CLI and the AWS SAM CLI. The best way to work with all of this is to open the environment in a container within your IDE (VS Code should prompt you to do so: use "Clone in Container" for best performance). This container will have all needed software installed.
99

10-
Then, run `make install` to install all packages, and `make local` to start the UI and API servers! The UI will be accessible on `http://localhost:5173/` and the API on `http://localhost:8080/`.
10+
Then, run `make install` to install all packages, and `make local` to start the UI and API servers! The UI will be accessible on `http://localhost:5173/` and the API on `http://localhost:8080/`.

cspell.config.yaml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
version: "0.2"
2+
ignorePaths:
3+
- cloudformation/**
4+
- Makefile
5+
- .github/**
6+
dictionaryDefinitions: []
7+
dictionaries: []
8+
words:
9+
- UIUC
10+
ignoreWords: []
11+
import: []

src/api/createSwagger.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ async function createSwaggerFiles() {
2020
await mkdir(outputDir, { recursive: true });
2121
const swaggerConfig = app.swagger();
2222
const realSwaggerConfig = JSON.parse(JSON.stringify(swaggerConfig));
23+
// set version
24+
if (process.env.VITE_BUILD_HASH) {
25+
realSwaggerConfig.info = realSwaggerConfig.info || {};
26+
realSwaggerConfig.info.version = process.env.VITE_BUILD_HASH;
27+
}
2328
realSwaggerConfig.components = realSwaggerConfig.components || {};
2429
realSwaggerConfig.components.securitySchemes = securitySchemes;
2530
const jsonSpec = JSON.stringify(realSwaggerConfig, null, 2);

0 commit comments

Comments
 (0)