Skip to content

Commit

Permalink
updated build workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
D3VL-Jack committed Jul 15, 2023
1 parent 7f61300 commit 62bb84c
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 31 deletions.
56 changes: 29 additions & 27 deletions .github/workflows/build-extension.yml
Original file line number Diff line number Diff line change
@@ -1,28 +1,30 @@
# Github Action that builds react extension and creates a zip file for deployment, updates the version in manifest.json from package.json and creates a release in github with the zip file
build-extension:
name: Build Extension
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: 20.x
- name: Install Dependencies
run: npm install
- name: Update Manifest
run: npm run update-manifest
- name: Build Extension
run: npm run build
- name: get-npm-version
id: package-version
uses: martinbeentjes/[email protected]
- name: Zip Extension
run: zip -r ${{ steps.package-version.outputs.current-version}}.zip build
- name: Create Release
run: |
gh release create ${{ steps.package-version.outputs.current-version}} -F ${{ steps.package-version.outputs.current-version}}.zip
gh release upload ${{ steps.package-version.outputs.current-version}} ${{ steps.package-version.outputs.current-version}}.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
name: Build Extension
on:
push:
tags:
- '*'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: 20.x
- name: Install Dependencies
run: npm install
- name: Update Manifest
run: npm run update-manifest ${{github.ref_name}}
- name: Build Extension
run: npm run build
- name: Zip Extension
run: zip -r ${{github.ref_name}}.zip build
- name: Create Release
run: |
gh release create ${{github.ref_name}} -F ${{github.ref_name}}.zip
gh release upload ${{github.ref_name}} ${{github.ref_name}}.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6 changes: 2 additions & 4 deletions scripts/update-manifest.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,14 @@
const fs = require("fs");
const path = require("path");

const package = path.join(__dirname, "../package.json");
const manifest = path.join(__dirname, "../public/manifest.json");

const packageJson = require(package);
const manifestJson = require(manifest);

manifestJson.version = packageJson.version;
manifestJson.version = process.argv[2];

const json = JSON.stringify(manifestJson, null, 4);

fs.writeFileSync(manifest, json);

console.log("Updated manifest.json with version from package.json");
console.log("Updated manifest.json with version " + process.argv[2]);

0 comments on commit 62bb84c

Please sign in to comment.