Skip to content

Commit

Permalink
moved version to .env
Browse files Browse the repository at this point in the history
  • Loading branch information
dharmesh-hemaram committed Oct 2, 2023
1 parent 99138a0 commit 2365953
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/tags.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ jobs:
FUNCTION_URL: ${{ steps.set-output-defaults.outputs.FUNCTION_URL}}
DISCORD_CLIENT_ID: ${{ steps.set-output-defaults.outputs.DISCORD_CLIENT_ID}}
OAUTH_CLIENT_ID: ${{ steps.set-output-defaults.outputs.OAUTH_CLIENT_ID}}
#version
RELEASE_VERSION: ${{ steps.set-output-defaults.outputs.RELEASE_VERSION}}
steps:
- name: set outputs with default values
id: set-output-defaults
Expand All @@ -58,6 +60,7 @@ jobs:
echo "DISCORD_CLIENT_ID='${{ vars.DISCORD_CLIENT_ID }}'" >> $GITHUB_OUTPUT
echo "OAUTH_CLIENT_ID=${{ vars.OAUTH_CLIENT_ID }}" >> $GITHUB_OUTPUT
echo "PUBLIC_URL=${{ vars.PUBLIC_URL }}" >> $GITHUB_OUTPUT
echo "RELEASE_VERSION=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV
main:
needs: [EnvSetup]
name: Nx Cloud - Main Job
Expand All @@ -84,8 +87,9 @@ jobs:
DISCORD_CLIENT_ID=${{needs.EnvSetup.outputs.DISCORD_CLIENT_ID}}
OAUTH_CLIENT_ID=${{needs.EnvSetup.outputs.OAUTH_CLIENT_ID}}
PUBLIC_URL=${{needs.EnvSetup.outputs.PUBLIC_URL}}
RELEASE_VERSION=${{needs.EnvSetup.outputs.RELEASE_VERSION}}
parallel-commands-on-agents: |
npx nx run-many --target=build --parallel=3 --exclude='tag:puppeteer' --args="--version=${{github.ref#refs/*/}}"
npx nx run-many --target=build --parallel=3 --exclude='tag:puppeteer'
final-commands: |
TARGET_FILE="./dist/apps/acf-extension/manifest.json"
# Use an if-else statement to check if the file exists.
Expand Down Expand Up @@ -120,7 +124,7 @@ jobs:
DISCORD_CLIENT_ID=${{needs.EnvSetup.outputs.DISCORD_CLIENT_ID}}
OAUTH_CLIENT_ID=${{needs.EnvSetup.outputs.OAUTH_CLIENT_ID}}
PUBLIC_URL=${{needs.EnvSetup.outputs.PUBLIC_URL}}
RELEASE_VERSION=${{needs.EnvSetup.outputs.RELEASE_VERSION}}
extension:
needs: [agents, main]
runs-on: ubuntu-latest
Expand Down
6 changes: 3 additions & 3 deletions apps/acf-extension/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@ const { composePlugins, withNx } = require('@nx/webpack');
const CopyPlugin = require('copy-webpack-plugin');
const Dotenv = require('dotenv-webpack');
const path = require('path');
function modify(buffer, version, { KEY, NX_NAME, OAUTH_CLIENT_ID }) {
function modify(buffer, { KEY, NX_NAME, OAUTH_CLIENT_ID, RELEASE_VERSION }) {
// copy-webpack-plugin passes a buffer
const manifest = JSON.parse(buffer.toString());

// make any modifications you like, such as
manifest.version = version;
manifest.version = RELEASE_VERSION;
manifest.name = NX_NAME;
if (OAUTH_CLIENT_ID) {
manifest.oauth2.client_id = OAUTH_CLIENT_ID;
Expand Down Expand Up @@ -45,7 +45,7 @@ module.exports = composePlugins(withNx(), (config, ctx) => {
from: './src/manifest.json',
to: './manifest.json',
transform(content) {
return modify(content, ctx.options.args.split('=')[1], process.env);
return modify(content, process.env);
},
},
],
Expand Down

0 comments on commit 2365953

Please sign in to comment.