Skip to content

Commit

Permalink
prepare CI pipeline to auto deploy
Browse files Browse the repository at this point in the history
  • Loading branch information
irnsght committed May 20, 2023
1 parent 9f48788 commit ef43403
Show file tree
Hide file tree
Showing 4 changed files with 88 additions and 21 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Release

on:
push:
tags:
- "v*.*.*"

permissions:
contents: write

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install Node.js and NPM
uses: actions/setup-node@v3
with:
node-version: "latest"

- name: "install dependencies"
run: npm ci

- name: full build and deploy
run: npm run deploy

- name: Get package version, write to .env file
run: echo "VERSION=$(node -p -e "require('./package.json').version")" >> "$GITHUB_ENV"

- name: Log version in js file
run: echo "//script.name=Puddler v${{ env.VERSION }} by IR0NSIGHT" | cat - dist/Puddler.js > temp && mv temp dist/Puddler.js

- name: Zip artifact
run: cd dist && zip -r Puddler_v${{ env.VERSION }}.zip . && cd ../..

- name: Release
uses: softprops/action-gh-release@v1
with:
files: dist/Puddler_v${{ env.VERSION }}.zip
44 changes: 23 additions & 21 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,27 +1,29 @@
{
"name": "puddler",
"version": "1.1.0",
"description": "",
"main": "Puddler.js",
"name": "puddler",
"version": "1.1.0",
"description": "",
"main": "Puddler.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"compile": "tsc -p ./tsconfig.json",
"test": "echo \"Error: no test specified\" && exit 1",
"compile": "tsc -p ./tsconfig.json",
"insertHeader": "bash ./shellscripts/insertHeader.sh",
"deploy": "npm run build && npm run insertHeader src/header.js dist/Puddler.js",
"build": "npm run compile && webpack"
},
"author": "",
"license": "ISC",
},
"author": "",
"license": "ISC",
"devDependencies": {
"@babel/core": "^7.21.8",
"@babel/polyfill": "^7.12.1",
"@babel/preset-env": "^7.21.5",
"babel-loader": "^9.1.2",
"core-js": "^3.30.2",
"ts-jest": "^29.1.0",
"ts-node": "^10.9.1",
"typescript": "^5.0.4",
"webpack": "^5.82.1",
"webpack-cli": "^5.1.1",
"webpack-dev-server": "^4.15.0"
},
"@babel/core" : "^7.21.8",
"@babel/polyfill" : "^7.12.1",
"@babel/preset-env" : "^7.21.5",
"babel-loader" : "^9.1.2" ,
"core-js" : "^3.30.2",
"ts-jest" : "^29.1.0",
"ts-node" : "^10.9.1",
"typescript" : "^5.0.4" ,
"webpack" : "^5.82.1",
"webpack-cli" : "^5.1.1" ,
"webpack-dev-server": "^4.15.0"
},
"dependencies": {}
}
19 changes: 19 additions & 0 deletions shellscripts/insertHeader.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

# Define the paths to the header and bundle files
header=$1
bundle=$2

echo "insert header file: $header target: $bundle";

# Make the bundle file writable
chmod +w "$bundle"

# Create a temporary file for the updated bundle
tmpfile=$(mktemp)

# Prepend the header to the bundle
cat "$header" "$bundle" > "$tmpfile"

# Replace the original bundle with the updated version
mv "$tmpfile" "$bundle"
5 changes: 5 additions & 0 deletions src/header.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// script.description= create natural creeks and ponds
// script.param.config.type=file
// script.param.config.description=Path to config
// script.param.config.optional=true
// script.param.config.default=\AdvancedOperator\Operations\example.json

0 comments on commit ef43403

Please sign in to comment.