-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
31 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]); |