Skip to content

Commit

Permalink
Fix script
Browse files Browse the repository at this point in the history
  • Loading branch information
mrruby committed Jun 19, 2024
1 parent 56b208d commit 60170e6
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions .github/workflows/extension.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,36 @@ jobs:
- name: Install pnpm
run: npm install -g pnpm
- name: Install chrome-webstore-item-property
run: pnpm add -D chrome-webstore-item-property -w
run: pnpm add -D chrome-web-store-item-property -w
- name: Check version against latest release in Chrome Web Store
id: check_version
uses: actions/github-script@v7
with:
script: |
const fs = require('fs/promises');
const chromeWebstoreItemProperty = require('chrome-webstore-item-property');
const chromeWebstoreItemProperty = require('chrome-web-store-item-property');
const getManifestVersion = async (filePath) => {
const data = await fs.readFile(filePath, 'utf8');
const manifest = JSON.parse(data);
return manifest.version;
};
const checkVersion = async (chromeId) => {
const latestVersion = await chromeWebstoreItemProperty(chromeId);
return latestVersion.version;
};
const fetchVersionInfo = async () => {
try {
const data = await fs.readFile('./holo-key-manager-extension/static/manifest.json', 'utf8');
const manifest = JSON.parse(data);
const currentVersion = manifest.version;
const latestVersion = await chromeWebstoreItemProperty('version', '${{ vars.CHROME_ID }}');
const currentVersion = await getManifestVersion('./holo-key-manager-extension/static/manifest.json');
const latestVersion = await checkVersion('${{ vars.CHROME_ID }}');
core.setOutput('abort', currentVersion === latestVersion ? 'true' : 'false');
} catch (error) {
core.setFailed(error.message);
}
};
fetchVersionInfo();
- name: Abort build if version matches
if: steps.check_version.outputs.abort == 'true'
Expand Down

0 comments on commit 60170e6

Please sign in to comment.