Skip to content

Commit 901e009

Browse files
authored
Add GitHub Actions support (#19)
* Add GitHub Actions support * Update package.json * Generate the manifest * Tweaks * Fixes * Remove Travis config
1 parent e0f89ba commit 901e009

File tree

12 files changed

+107
-24
lines changed

12 files changed

+107
-24
lines changed

.github/workflows/ci.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: aoc-to-markdown CI
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
pull_request:
8+
branches:
9+
- master
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
15+
strategy:
16+
matrix:
17+
node-version: [10.x, 12.x, 14.x]
18+
19+
steps:
20+
- uses: actions/checkout@v2
21+
- name: Use Node.js ${{ matrix.node-version }}
22+
uses: actions/setup-node@v1
23+
with:
24+
node-version: ${{ matrix.node-version }}
25+
- run: npm ci
26+
- run: npm run lint
27+
- run: npm run build

.github/workflows/release.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: aoc-to-markdown Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v2
13+
- name: Use Node.js ${{ matrix.node-version }}
14+
uses: actions/setup-node@v1
15+
with:
16+
node-version: ${{ matrix.node-version }}
17+
- run: npm ci
18+
- run: npm run lint
19+
- run: npm run build
20+
- name: Create Release
21+
id: create_release
22+
uses: actions/create-release@v1
23+
env:
24+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
25+
with:
26+
tag_name: ${{ github.ref }}
27+
release_name: Advent of Code to Markdown ${{ github.ref }}
28+
draft: false
29+
prerelease: false
30+
- name: Upload Release Asset
31+
uses: actions/upload-release-asset@v1
32+
env:
33+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
34+
with:
35+
upload_url: ${{ steps.create_release.outputs.upload_url }}
36+
asset_path: ./web-ext-artifacts/aoc-to-markdown.zip
37+
asset_name: aoc-to-markdown-${{ github.ref }}.zip
38+
asset_content_type: application/zip

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,5 +62,6 @@ typings/
6262

6363
# Build output
6464
/addon/**/*.js
65+
/addon/manifest.json
6566
web-ext-artifacts/
6667
.web-extension-id

.travis.yml

Lines changed: 0 additions & 15 deletions
This file was deleted.

BUILDING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
- Install [Node 14](https://nodejs.org/en/download/)
66

77
## Build
8-
8+
99
- Run `npm install`
1010
- Run `npm run build`
1111

package.json

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,17 @@
33
"version": "1.0.11",
44
"description": "Converts a given Advent of Code page to a GitHub-compatible Markdown file.",
55
"scripts": {
6-
"build": "webpack && web-ext build -s addon --overwrite-dest",
6+
"build": "npm run compile && web-ext build -n aoc-to-markdown.zip -s addon --overwrite-dest",
7+
"compile": "npm run genmanifest && webpack",
8+
"genmanifest": "node ./tools/genmanifest.js ./src/manifest.json ./addon/manifest.json",
79
"lint": "eslint . && web-ext lint -s addon",
810
"lint-fix": "eslint . --fix",
9-
"start": "npm run build && web-ext run -s addon",
10-
"test": "echo \"Error: no test specified\" && exit 1"
11+
"prepare": "npm run compile",
12+
"prestart": "npm run compile",
13+
"pretest": "npm run compile",
14+
"start": "web-ext run -s addon",
15+
"test": "echo \"Error: no test specified\" && exit 1",
16+
"version": "npm run genmanifest"
1117
},
1218
"license": "MIT",
1319
"devDependencies": {

background_scripts/background.js renamed to src/background_scripts/background.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ runtime.onMessage.addListener((data, sender) => {
1919
switch (data.action) {
2020
case "saveAs":
2121
saveAs(data.text).catch((err) => {
22-
console.error('Failed to save content', err);
22+
console.error("Failed to save content", err);
2323
});
2424
break;
2525

File renamed without changes.
File renamed without changes.

addon/manifest.json renamed to src/manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"manifest_version": 2,
33
"name": "Advent of Code to Markdown",
4-
"version": "1.0.11",
4+
"version": null,
55
"description": "Converts a given Advent of Code page to a GitHub-compatible Markdown file.",
66
"icons": {
77
"16": "icons/aoc-to-markdown-16.png",

0 commit comments

Comments
 (0)