Skip to content

Commit

Permalink
upd build and ci
Browse files Browse the repository at this point in the history
  • Loading branch information
lukachi committed May 16, 2024
1 parent d624931 commit 053ba25
Show file tree
Hide file tree
Showing 10 changed files with 13 additions and 19 deletions.
3 changes: 0 additions & 3 deletions .env-development

This file was deleted.

2 changes: 1 addition & 1 deletion .env-analyze → .env.development
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VITE_ENVIRONMENT=analyze
VITE_PORT=8095
VITE_API_URL='https://jsonplaceholder.typicode.com'
VITE_APP_NAME='React Template'

1 change: 0 additions & 1 deletion .env-production → .env.production
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
VITE_ENVIRONMENT=production
VITE_PORT=8095
VITE_API_URL='https://jsonplaceholder.typicode.com'
VITE_APP_NAME='React Template'
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ jobs:
echo $GITHUB_SHA
- name: Run Build
env: # Or as an environment variable
# VITE_APP_DOMAIN: https://my.domain.com
VITE_MODE: 'development'
run: |
cp .env-development .env
. $(werf ci-env github --as-file)
werf export --dev web --tag ghcr.io/$GITHUB_REPOSITORY:$GITHUB_SHA
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,8 @@ jobs:
echo $GITHUB_SHA
- name: Run Build
env: # Or as an environment variable
# VITE_APP_DOMAIN: https://my.domain.com
VITE_MODE: 'staging'
run: |
cp .env-development .env
. $(werf ci-env github --as-file)
werf export --dev web --tag ghcr.io/$GITHUB_REPOSITORY:$GITHUB_SHA
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ jobs:
docker version
echo $GITHUB_REPOSITORY
echo $GITHUB_REF_NAME
- name: Run Build
env: # Or as an environment variable
# VITE_APP_DOMAIN: https://my.domain.com
VITE_MODE: 'production'
run: |
cp .env-production .env
. $(werf ci-env github --as-file)
werf export --dev web --tag ghcr.io/$GITHUB_REPOSITORY:$GITHUB_REF_NAME
Expand Down
2 changes: 0 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,5 @@ stats.html
!.yarn/sdks
!.yarn/versions

.env.production
.env.development
.env.analyze
tsconfig.tsbuildinfo
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"pre-push": "yarn rsc"
},
"scripts": {
"build": "dotenv -e .env vite build",
"start": "dotenv -e .env vite",
"build": "vite build",
"start": "vite",
"analyze": "vite build --mode analyze",
"lint": "yarn lint:styles && yarn lint:scripts",
"lint:styles": "stylelint \"src/**/*.{css,sass,scss}\" --max-warnings=0",
Expand Down
7 changes: 4 additions & 3 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@ const root = path.resolve(__dirname, resolveApp('src'))
export default defineConfig(({ mode }) => {
const env = loadEnv(mode, process.cwd(), '')

// const isProduction = env.VITE_ENVIRONMENT === 'production'
// const isDevelopment = env.VITE_ENVIRONMENT === 'development'
const isAnalyze = env.VITE_ENVIRONMENT === 'analyze'
// const isProduction = mode === 'production'
// const isDevelopment = mode === 'development'
const isAnalyze = mode === 'analyze'

// const buildVersion = env.VITE_APP_BUILD_VERSION

return {
Expand Down
3 changes: 2 additions & 1 deletion werf.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ shell:
- yarn install
setup:
- cd /app
- yarn build
- export VITE_MODE="{{ env "VITE_MODE" }}"
- if [ -n "$VITE_MODE" ]; then yarn build --mode $VITE_MODE; else yarn build; fi
#- sh -c '[ -d /app/dist/files ] && echo "$FILE exist." || mkdir -p /app/dist/files'
#- sh -c '[ -d /app/files ] && echo "$FILE exist." || mkdir -p /app/files'
#- sh -c '[ -z "`ls /app/files`" ] && echo "Empty" || cp -r /app/files/* /app/dist/files'
Expand Down

0 comments on commit 053ba25

Please sign in to comment.