Skip to content

Commit

Permalink
Add automated build
Browse files Browse the repository at this point in the history
  • Loading branch information
duncte123 committed Jun 30, 2020
1 parent d59e06a commit 520d14a
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 10 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions

name: Build and release

on:
push:
branches: [ master ]

jobs:
build:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [14.x]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm run build --if-present
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ github.run_number }}
release_name: Release ${{ github.run_number }}
body: |
Automated release
draft: false
prerelease: false
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
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
asset_path: ./dist/owoify.bundle.js
asset_name: owoify.bundle.js
asset_content_type: application/javascript
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.idea/
node_modules/
dist/
1 change: 0 additions & 1 deletion dist/owoify.bundle.js

This file was deleted.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
"description": "",
"private": true,
"scripts": {
"build": "webpack --config webpack.config.js",
"build": "webpack --config webpack.config.js --env.MODE=production",
"build:dev": "webpack --config webpack.config.js --env.MODE=development",
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
Expand Down
18 changes: 10 additions & 8 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
const path = require('path');

module.exports = {
target: 'node',
mode: 'production',
entry: './src/owoify.js',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'owoify.bundle.js',
},
module.exports = (env) => {
return {
target: 'node',
mode: env.MODE,
entry: './src/owoify.js',
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'owoify.bundle.js',
},
};
};

0 comments on commit 520d14a

Please sign in to comment.