Skip to content

Commit

Permalink
fix: Add ci (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan Faircloth committed Apr 7, 2021
1 parent 729f42e commit 41c5a1a
Show file tree
Hide file tree
Showing 8 changed files with 9,086 additions and 8,665 deletions.
File renamed without changes.
49 changes: 49 additions & 0 deletions ui/.github/workflows/build.yml
@@ -0,0 +1,49 @@
# 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

on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [12.x, 14.x, 15.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
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 install --global yarn

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- uses: actions/cache@v1
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-${{ matrix.node-version }}
- run: yarn run setup
- run: yarn run build
#- run: yarn run test

#package the output
- run: tar -czf /tmp/splunk-ucc-ui.tgz -C dist .

- uses: actions/upload-artifact@v2
with:
name: splunk-ucc-ui
path: /tmp/splunk-ucc-ui.tgz
21 changes: 21 additions & 0 deletions ui/.github/workflows/pr-release-notes.yaml
@@ -0,0 +1,21 @@
name: Release-Notes-Preview

on:
pull_request:
branches: [main, develop]
issue_comment:
types: [edited]

jobs:
preview:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: |
git fetch --prune --unshallow --tags
- uses: snyk/release-notes-preview@v1.6.1
with:
releaseBranch: master
env:
GITHUB_PR_USERNAME: ${{ github.actor }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
57 changes: 57 additions & 0 deletions ui/.github/workflows/release.yml
@@ -0,0 +1,57 @@
# 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: release

on:
workflow_run:
workflows: ["build"]
branches: [main, develop]
types:
- completed
- requested

jobs:
release:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [15.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
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 install --global yarn
- run: npm install --global semantic-release
- run: npm install --global semantic-release/github
- run: npm install --global semantic-release/exec

- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"

- uses: actions/cache@v1
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-${{ matrix.node-version }}
- run: yarn run setup
- run: yarn run build
#- run: yarn run test

- uses: actions/upload-artifact@v2
with:
name: splunk-ucc-ui
path: /tmp/splunk-ucc-ui.tgz

- name: Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
run: npx semantic-release
2 changes: 1 addition & 1 deletion ui/.gitignore
Expand Up @@ -105,4 +105,4 @@ dist


# output
stage
dist/**
21 changes: 21 additions & 0 deletions ui/.releaserc
@@ -0,0 +1,21 @@
{
"branches": ["main",
{
"name": "develop",
"channel": "beta",
"prerelease": 'beta'
}
],
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
["@semantic-release/exec", {
"publishCmd": "tar -czf /tmp/splunk-ucc-ui.tgz -C dist ."
}],
["@semantic-release/github", {
"assets": [
{"path": "/tmp/splunk-ucc-ui.tgz", "label": "splunk-ucc-ui"},
]
}],
]
}
4 changes: 2 additions & 2 deletions ui/webpack.config.js
Expand Up @@ -8,7 +8,7 @@ module.exports = webpackMerge(baseConfig, {
entry_page: path.join(__dirname, 'src/main/webapp/pages/entry_page'),
},
output: {
path: path.join(__dirname, 'stage/appserver/static/js/build'),
path: path.join(__dirname, 'dist/appserver/static/js/build'),
filename: '[name].js',
},
module: {
Expand All @@ -23,7 +23,7 @@ module.exports = webpackMerge(baseConfig, {
new CopyWebpackPlugin([
{
from: path.join(__dirname, 'src/main/resources/splunk'),
to: path.join(__dirname, 'stage'),
to: path.join(__dirname, 'dist'),
},
]),
],
Expand Down

0 comments on commit 41c5a1a

Please sign in to comment.