Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: run tests
on:
pull_request:
branches:
- main

jobs:
test:
runs-on: ubuntu-latest #通常はubuntu-latestにすることが多い、ubuntuはLinuxを用いたOSの一つで、ci/cd時にもよく使われる

steps:
- name: checkout repository
uses: actions/checkout@v7 #v3だと古い

- name: Use Node.js
uses: actions/setup-node@v7 #v4は2024年ごろの主流
with:
node-version: '24'
cache: 'npm'

- name: Install dependencies #continuous intengrationではなくclean install
run: npm ci

- name: build package
run: npm run build

- name: run tests
run: npm test

44 changes: 44 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: release
on:
push:
branches:
- main
paths:
- packages/browser/manifest.json

jobs:
release:
runs-on: ubuntu-latest #通常はubuntu-latestにすることが多い、ubuntuはLinuxを用いたOSの一つで、ci/cd時にもよく使われる

steps:
- name: checkout repository
uses: actions/checkout@v7 #v3だと古い

- name: Use Node.js
uses: actions/setup-node@v7 #v4は2024年ごろの主流
with:
node-version: '24'
cache: 'npm'

- name: Install dependencies #continuous intengrationではなくclean install
run: npm ci

- name: build package
run: npm run build

- name: run tests
run: npm test

- name: compress dist folder
run: node compress.js

- name: Submit
run: |
npx chrome-webstore-upload-cli@4 --source extension.zip
env:
EXTENSION_ID: ${{ secrets.EXTENSION_ID }}
CLIENT_ID: ${{ secrets.CLIENT_ID }}
CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }}
REFRESH_TOKEN: ${{ secrets.REFRESH_TOKEN }}
PUBLISHER_ID: ${{ secrets.PUBLISHER_ID }}

1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@ node_modules/
dist/
*.vsix
.DS_Store
/extension.zip
26 changes: 26 additions & 0 deletions compress.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
const fs = require("node:fs");
const path = require("node:path");
const { ZipArchive } = require("archiver");

const sourceDir = path.join(__dirname, "packages/browser/dist");
const outputPath = path.join(__dirname, "extension.zip");

const output = fs.createWriteStream(outputPath);
const archive = new ZipArchive({ zlib: { level: 9 } });

output.on("close", () => {
console.log(`Created extension.zip (${archive.pointer()} bytes)`);
});

archive.on("error", (error) => {
throw error;
});

archive.on("warning", (error) => {
throw error;
});

archive.pipe(output);
archive.directory(sourceDir, false);

archive.finalize();
Loading