Skip to content

Commit 01261e9

Browse files
committed
setup release automation
1 parent 2af7814 commit 01261e9

File tree

8 files changed

+49
-5
lines changed

8 files changed

+49
-5
lines changed

.github/workflows/build.yml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ jobs:
113113
publish:
114114
name: Publish release
115115
needs: [build]
116-
# if: startsWith(github.ref, 'refs/tags/')
116+
if: startsWith(github.ref, 'refs/tags/')
117117
runs-on: ubuntu-latest
118118
steps:
119119
- name: Checkout
@@ -124,7 +124,18 @@ jobs:
124124
with:
125125
pattern: odiff-*.exe
126126
merge-multiple: true
127-
destination-path: npm_package/raw_binaries
127+
path: npm_package/raw_binaries
128128

129-
- run: tree npm_package
129+
- name: Publish npm package
130+
working-directory: npm_package
131+
run: npm publish
132+
env:
133+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
134+
135+
- name: Create github release
136+
uses: softprops/action-gh-release@v1
137+
with:
138+
files: "npm_package/raw_binaries/*"
139+
env:
140+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
130141

npm_package/bin/odiff

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env node
2+
3+
console.error("odiff: seems like a binary executable for your OS wasn't linked. Please verify that postinstsall script run successfully")
4+
process.exit(1);
File renamed without changes.
File renamed without changes.

npm_package/package.json

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"name": "odiff-bin",
3+
"version": "3.1.0",
4+
"author": "Dmitriy Kovalenko <[email protected]>",
5+
"license": "MIT",
6+
"description": "The fastest image difference tool in the world",
7+
"scripts": {
8+
"postinstall": "node ./post_install.js"
9+
},
10+
"types": "odiff.d.ts",
11+
"main": "odiff.js",
12+
"keywords": [
13+
"visual-regression",
14+
"pixelmatch",
15+
"image",
16+
"comparison",
17+
"diff"
18+
]
19+
}

release.sh

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,3 +14,13 @@ dune build
1414
sed -i "s/\"version\": \"[^\"]*\"/\"version\": \"$VERSION\"/g" package.json
1515
npm install
1616

17+
sed -i "s/\"version\": \"[^\"]*\"/\"version\": \"$VERSION\"/g" npm_package/package.json
18+
19+
git commit -m "chore(release): v$VERSION"
20+
21+
git tag "v$VERSION"
22+
23+
git push origin "v$VERSION"
24+
25+
git push
26+

test/node-binding.test.cjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const path = require("path");
22
const test = require("ava");
3-
const { compare } = require("../bin/node-bindings/odiff");
3+
const { compare } = require("../npm_package/odiff");
44

55
const IMAGES_PATH = path.resolve(__dirname, "..", "images");
66
const BINARY_PATH = path.resolve(

test/node-bindings.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { compare } from "../bin/node-bindings/odiff";
1+
import { compare } from "../npm_package/odiff";
22

33
// allow no options
44
compare("path1", "path2", "path3")

0 commit comments

Comments
 (0)