Skip to content

Commit

Permalink
Update code build test
Browse files Browse the repository at this point in the history
  • Loading branch information
anhnhu committed May 14, 2024
1 parent 1007dfb commit c1781bb
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/push-webapp-test-01.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.GH_PAT }}
token: ${{ secrets.GH_AUTOMATION_TOKEN }}
- name: Setup Node
uses: actions/setup-node@v3
with:
Expand All @@ -40,7 +40,7 @@ jobs:
if [ ${{ github.ref_name }} == 'telegram-wallet' ]; then
yarn run webapp:change-build-number
fi
yarn webapp:build --env GAME_API_HOST ${{ secrets.GAME_DEV_SERVER_1 }}
yarn webapp:build --env GAME_API_HOST ${{ secrets.GAME_DEV_SERVER_1 }} TELEGRAM_WEBAPP_LINK ${{ secrets.TELEGRAM_WEBAPP_LINK_01 }}
- name: Publish to Cloudflare Pages
id: cloudflare_deployment
uses: cloudflare/pages-action@v1
Expand Down
18 changes: 18 additions & 0 deletions packages/webapp/webpack.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,21 @@ const HtmlWebpackPlugin = require('html-webpack-plugin');

const args = process.argv.slice(2);
let mode = 'production';
let apiGameHost = 'https://game-api.anhmtv.xyz';
let telegramLink = '';


if (args) {
args.forEach((p, index) => {
if (p === '--mode') {
mode = args[index + 1] || mode;
}
if (p === 'GAME_API_HOST') {
apiGameHost = args[index + 1] || apiGameHost;
}
if (p === 'TELEGRAM_WEBAPP_LINK') {
telegramLink = args[index + 1] || telegramLink;
}
});
}

Expand Down Expand Up @@ -61,6 +70,15 @@ const _additionalEnv = {
TELEGRAM_WEBAPP_LINK: JSON.stringify(process.env.TELEGRAM_WEBAPP_LINK)
};

if (!_additionalEnv.GAME_API_HOST){
_additionalEnv.GAME_API_HOST = JSON.stringify(apiGameHost);
}

if (!_additionalEnv.TELEGRAM_WEBAPP_LINK){
_additionalEnv.GAME_API_HOST = JSON.stringify(telegramLink);
}
console.log('GAME_API_HOST: ', apiGameHost);
console.log('TELEGRAM_WEBAPP_LINK: ', telegramLink);
const createConfig = (entry, alias = {}, useSplitChunk = false) => {
const result = {
context: __dirname,
Expand Down

0 comments on commit c1781bb

Please sign in to comment.