Skip to content

Commit 520d14a

Browse files
committed
Add automated build
1 parent d59e06a commit 520d14a

File tree

5 files changed

+61
-10
lines changed

5 files changed

+61
-10
lines changed

.github/workflows/release.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
3+
4+
name: Build and release
5+
6+
on:
7+
push:
8+
branches: [ master ]
9+
10+
jobs:
11+
build:
12+
13+
runs-on: ubuntu-latest
14+
15+
strategy:
16+
matrix:
17+
node-version: [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 build --if-present
27+
- name: Create Release
28+
id: create_release
29+
uses: actions/create-release@v1
30+
env:
31+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32+
with:
33+
tag_name: v${{ github.run_number }}
34+
release_name: Release ${{ github.run_number }}
35+
body: |
36+
Automated release
37+
draft: false
38+
prerelease: false
39+
- name: Upload Release Asset
40+
id: upload-release-asset
41+
uses: actions/upload-release-asset@v1
42+
env:
43+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
44+
with:
45+
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
46+
asset_path: ./dist/owoify.bundle.js
47+
asset_name: owoify.bundle.js
48+
asset_content_type: application/javascript

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
.idea/
22
node_modules/
3+
dist/

dist/owoify.bundle.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
"description": "",
55
"private": true,
66
"scripts": {
7-
"build": "webpack --config webpack.config.js",
7+
"build": "webpack --config webpack.config.js --env.MODE=production",
8+
"build:dev": "webpack --config webpack.config.js --env.MODE=development",
89
"test": "echo \"Error: no test specified\" && exit 1"
910
},
1011
"keywords": [],

webpack.config.js

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
const path = require('path');
22

3-
module.exports = {
4-
target: 'node',
5-
mode: 'production',
6-
entry: './src/owoify.js',
7-
output: {
8-
path: path.resolve(__dirname, 'dist'),
9-
filename: 'owoify.bundle.js',
10-
},
3+
module.exports = (env) => {
4+
return {
5+
target: 'node',
6+
mode: env.MODE,
7+
entry: './src/owoify.js',
8+
output: {
9+
path: path.resolve(__dirname, 'dist'),
10+
filename: 'owoify.bundle.js',
11+
},
12+
};
1113
};

0 commit comments

Comments
 (0)