Skip to content

Commit

Permalink
Add pr number to version
Browse files Browse the repository at this point in the history
  • Loading branch information
sonic16x committed Nov 25, 2024
1 parent 9b9279f commit 2d282e8
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 35 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,8 @@ jobs:

- name: Build
env:
DEMO: true
NODE_ENV: production
PR_NUMBER: ${{ env.GITHUB_REF_NAME }}
run: |
npm run generate-dictionary
npx webpack --config webpack.config.prod.js
Expand Down
8 changes: 8 additions & 0 deletions build-manifest.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
const fs = require('fs');
const manifest = require('./src/manifest.json');

if (process.env.PR_NUMBER && process.env.PR_NUMBER.length) {
manifest.name = manifest.short_name =`Test ${process.env.PR_NUMBER}`
}

fs.writeFileSync('./dist/manifest.json', JSON.stringify(manifest));
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
"main": "./dist/worker.js",
"scripts": {
"build": "cross-env NODE_ENV=production webpack --config webpack.config.prod.js",
"build": "cross-env NODE_ENV=production webpack --config webpack.config.prod.js && node build-manifest.js",
"build-storybook": "storybook build",
"deploy-api": "wrangler deploy ./src/server/index.ts --name api --compatibility-date 2024-11-12",
"dev": "cross-env NODE_ENV=development webpack serve --config webpack.config.dev.js --progress",
Expand Down
35 changes: 2 additions & 33 deletions src/components/Pages/About/About.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export const About =
const worksheetUrl = getTablePublicUrl(tablesData[0].spreadsheetId, tablesData[0].sheetId);
const email = '[email protected]';
const source = 'http://steen.free.fr/interslavic';
const version = [VERSION, PR_NUMBER].filter((item) => item && item.length).join('-')

return (
<div className="about-page">
Expand Down Expand Up @@ -113,40 +114,8 @@ export const About =
</a>
</div>
<hr/>
<div className="about-page__badges">
{/*<a
href="https://play.google.com/store/apps/details?id=org.interslavicdictionary.twa&pcampaignid=pcampaignidMKT-Other-global-all-co-prtnr-py-PartBadge-Mar2515-1"
className="badge_google-play"
title="Get it on Google Play"
target="_blank"
rel="noreferrer"
>
<img
alt="Get it on Google Play"
width="200px"
src="https://play.google.com/intl/en_us/badges/static/images/badges/en_badge_web_generic.png"
/>
</a>*/}

{IS_COM && (
<a
href="https://discord.com/invite/n3saqm27QW"
title="Get it on Discord"
className="badge_discord"
target="_blank"
rel="noreferrer"
>
<img
alt="Get it on Discord"
width="165px"
style={{ padding: "13px 0px" }}
src="icons/discord-icon-330x102.png"
/>
</a>
)}
</div>
</div>
<div className="about-page__release-date">v{VERSION}</div>
<div className="about-page__release-date">v{version}</div>
</div>
</div>
);
Expand Down
1 change: 1 addition & 0 deletions src/custom.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ declare module '*.svg' {

declare const FB: any;
declare const IS_COM: boolean;
declare const PR_NUMBER: string;
declare const Az: any;
File renamed without changes.
1 change: 1 addition & 0 deletions webpack.config.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ module.exports = {
'process.env.NODE_ENV': JSON.stringify('development'),
IS_COM: true,
VERSION: JSON.stringify(require('./package.json').version),
PR_NUMBER: '123',
}),
new CopyWebpackPlugin({
patterns: [
Expand Down
1 change: 1 addition & 0 deletions webpack.config.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ module.exports = {
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('production'),
VERSION: JSON.stringify(require('./package.json').version),
PR_NUMBER: process.env.PR_NUMBER,
}),
new CopyWebpackPlugin({
patterns: [
Expand Down

0 comments on commit 2d282e8

Please sign in to comment.