Skip to content

Commit

Permalink
feat: set github actions env via generated env file
Browse files Browse the repository at this point in the history
  • Loading branch information
ZipingL committed Oct 28, 2023
1 parent a6ff4f6 commit 8b0896b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .github/workflows/canaryapp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ jobs:
run: npm install
- name: Build
run: npm run build:canary
- name: Read Build Timestamped Env from .env FILE generated
run: |
cat .env | grep "DATEMODIFIED_CODE_DEPLOYMENT" | cut -d '=' -f2 > ${{ env.DATEMODIFIED_CODE_DEPLOYMENT }}
- name: deploy to gh-pages
uses: peaceiris/actions-gh-pages@v3
with:
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
node_modules
build
build
.env
4 changes: 4 additions & 0 deletions scripts/public.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,5 +169,9 @@ const htmlMiny = minify(htmlNew, {
});
if(process && process?.env){
process.env.DATEMODIFIED_CODE_DEPLOYED = modifiedDate;
} else {
const env_filestring = `DATEMODIFIED_CODE_DEPLOYED=${modifiedDate}`;
fs.writeFileSync(path.resolve(__dirname, '../.env'), env_filestring, 'utf8');
}

fs.writeFileSync(path.resolve(__dirname, '../build/index.html'), htmlMiny, 'utf8');

0 comments on commit 8b0896b

Please sign in to comment.