Separate chromium and firefox action workflow files

This commit is contained in:
Folyd 2020-04-11 00:03:03 +08:00
parent 081212291e
commit 9fa462f313
4 changed files with 38 additions and 20 deletions

37
.github/workflows/chromium.yml vendored Normal file
View file

@ -0,0 +1,37 @@
name: "Chromium Version"
on:
create:
tags:
- v*
jobs:
build:
name: "Build"
runs-on: ubuntu-latest
steps:
- name: "Checkout"
uses: actions/checkout@v1
- name: Install Jsonnet
run: sudo snap install jsonnet
# https://stackoverflow.com/questions/58177786/get-the-current-pushed-tag-in-github-actions
- name: "Set output"
id: vars
run: echo ::set-output name=tag::$(echo ${GITHUB_REF:10})
- name: Generate Chrome manifest.json
run: make manifest browser=chrome
- name: "web-ext build"
id: web-ext-build-chrome
uses: kewisch/action-web-ext@v1
with:
cmd: build
source: extension
- name: "Upload Artifact"
uses: actions/upload-artifact@master
with:
name: chrome-rust-search-extension-${{ steps.vars.outputs.tag }}
path: ${{ steps.web-ext-build-chrome.outputs.target }}

View file

@ -1,4 +1,4 @@
name: "build"
name: "Firefox Version"
on:
create:
tags:
@ -20,22 +20,6 @@ jobs:
id: vars
run: echo ::set-output name=tag::$(echo ${GITHUB_REF:10})
- name: Generate Chrome manifest.json
run: make manifest browser=chrome
- name: "web-ext build"
id: web-ext-build-chrome
uses: kewisch/action-web-ext@v1
with:
cmd: build
source: extension
- name: "Upload Artifact"
uses: actions/upload-artifact@master
with:
name: chrome-rust-search-extension-${{ steps.vars.outputs.tag }}
path: ${{ steps.web-ext-build-chrome.outputs.target }}
- name: Generate Firefox manifest.json
run: make manifest browser=firefox

View file

@ -14,13 +14,11 @@ chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
console.log("message :", message);
switch (message.action) {
case "check": {
console.log("message check");
sendResponse({added: message.crateName in CrateDocSearchManager.getCrates()});
break;
}
case "add": {
CrateDocSearchManager.addCrate(message.crateName, message.crateVersion, message.searchIndex);
console.log(message);
sendResponse(true);
break;
}

View file

@ -117,7 +117,6 @@ window.addEventListener("message", function(event) {
if (event.source === window &&
event.data &&
event.data.direction === "rust-search-extension") {
console.log(event.data.message);
chrome.runtime.sendMessage({action: "add", ...event.data.message},
(response) => {
console.log(response);