Skip to content

Commit

Permalink
feat: add publish script, rename to replace_maps
Browse files Browse the repository at this point in the history
  • Loading branch information
nobkd committed Oct 3, 2023
1 parent 8bba9d6 commit 1682087
Show file tree
Hide file tree
Showing 6 changed files with 102 additions and 91 deletions.
108 changes: 55 additions & 53 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,60 +1,62 @@
name: CI

on:
push:
branches:
- main
pull_request:
branches:
- main
push:
branches:
- main
pull_request:
branches:
- main

concurrency:
group: ${{ github.ref }}
cancel-in-progress: false
group: ${{ github.ref }}
cancel-in-progress: false

jobs:
lint:
name: Lint
timeout-minutes: 10
runs-on: self-hosted

steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18

- name: Install
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: ${{ runner.os }}-node-

- run: npm ci

- name: Lint
run: npm run format

test:
name: Test
timeout-minutes: 10
runs-on: self-hosted

steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18

- name: Install
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: ${{ runner.os }}-node-

- run: npm ci

- name: Test
run: npm run test:cov
lint:
name: Lint
timeout-minutes: 10
runs-on: self-hosted

steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18

- name: Install
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: ${{ runner.os }}-node-

- run: npm ci

- name: Lint
run: npm run format

test:
name: Test
timeout-minutes: 10
runs-on: self-hosted

steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18

- name: Install
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: ${{ runner.os }}-node-

- run: npm ci

- name: Test
run: npm run test:cov

- run: echo "https://github.com/nobkd/replace-maps/archive/refs/tags/${{ github.ref_name }}.zip"
71 changes: 40 additions & 31 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,38 +1,47 @@
name: Publish

on:
release:
types: [published]
release:
types: [published]

concurrency:
group: ${{ github.ref }}
cancel-in-progress: false
group: ${{ github.ref }}
cancel-in-progress: false

jobs:
publish:
name: Publish to Firefox AMO
timeout-minutes: 10
runs-on: self-hosted

steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18

- name: Install
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: ${{ runner.os }}-node-

- run: npm ci

- name: Build
run: npm run build

- name: Bundle
run: npm run bundle

# Send non-minified code to AMO, Sign file with AMO, Upload artifacts to release
publish:
name: Publish to Firefox AMO
timeout-minutes: 10
runs-on: self-hosted

steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18

- name: Install
uses: actions/cache@v3
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: ${{ runner.os }}-node-

- run: npm ci

- name: Build
run: npm run build

- name: Bundle
run: npm run bundle

- name: Release
uses: browser-actions/release-firefox-addon@latest
with:
addon-id: "replace_maps@nobkd.github.io"
addon-path: "out/replace_maps.zip"
source-path: "https://github.com/nobkd/replace-maps/archive/refs/tags/${{ github.ref_name }}.zip"
approval-note: |
Follow the instructions in AMO-README.md
auth-api-issuer: ${{ secrets.AUTH_API_ISSUER }}
auth-api-secret: ${{ secrets.AUTH_API_SECRET }}
4 changes: 2 additions & 2 deletions AMO-README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Prequisites

- Node (18)
- Node 18
- npm

## Installation
Expand All @@ -19,4 +19,4 @@ This uses the `package-lock.json` file for installation to avoid package changes
npm run build && npm run bundle
```

This transpiles and minifies the TypeScript, copies static resources and bundles the output to the `out` directory of the project.
This transpiles and minifies the TypeScript, copies static resources and bundles the output to `out/replace_maps.zip`.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "replace-maps",
"name": "replace_maps",
"description": "Replace Google Maps iFrames with OSM",
"author": "nobkd",
"license": "MPL-2.0",
Expand Down Expand Up @@ -27,7 +27,7 @@
"build": "tsc && vite build",
"serve:firefox": "web-ext run -s dist",
"serve:chromium": "web-ext run -t chromium -s dist",
"bundle": "web-ext build -s dist -a out --overwrite-dest",
"bundle": "web-ext build -s dist -a out --overwrite-dest -n replace_maps.zip",
"bump-manifest": "sh scripts/bump.sh",
"release": "npm run format:fix; release-it"
},
Expand Down
2 changes: 1 addition & 1 deletion public/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
},
"browser_specific_settings": {
"gecko": {
"id": "replace-maps@nobkd.github.io",
"id": "replace_maps@nobkd.github.io",
"strict_min_version": "89.0"
}
},
Expand Down

0 comments on commit 1682087

Please sign in to comment.