Skip to content

Commit

Permalink
add and update workflows (#10)
Browse files Browse the repository at this point in the history
Signed-off-by: Emily Rodriguez <[email protected]>

Signed-off-by: Emily Rodriguez <[email protected]>
Co-authored-by: Emily Rodriguez <[email protected]>
  • Loading branch information
em-c-rod and Emily Rodriguez authored Dec 28, 2022
1 parent 6611fef commit 9b4403b
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 6 deletions.
11 changes: 5 additions & 6 deletions .github/workflows/e2e-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@ on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
build:
runs-on: ubuntu-20.04

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Cache node modules
uses: actions/cache@v2
Expand All @@ -20,7 +19,7 @@ jobs:
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/yarn.lock') }}
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
Expand All @@ -29,10 +28,10 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v1
with:
node-version: '16.x'
node-version: '18.x'

- name: Install dependencies
run: npm install
run: npm ci

- name: Run e2e tests
run: yarn test
run: npm test
14 changes: 14 additions & 0 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,20 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Setup Node.js
uses: actions/setup-node@v1
with:
Expand Down
35 changes: 35 additions & 0 deletions .github/workflows/push-to-gpr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Build and Release NPM to GPR (GitHub Package Registry)
on:
release:
types: [published]

jobs:
build-deploy:
runs-on: ubuntu-18.04
steps:
- uses: actions/checkout@v3

- name: Setup node
uses: actions/setup-node@v1
with:
node-version: "18.x"
registry-url: https://npm.pkg.github.com/
scope: '@mitre'

- name: Build the NPM Package
run: |
npm install
npm run build
- name: Pack all items that are published
run: npm pack
# Setup .npmrc file to publish to GitHub Package Registry
- uses: actions/setup-node@v1
with:
registry-url: 'https://npm.pkg.github.com'
scope: '@mitre'

# Publish inspec-objects to GitHub Package Registry
- name: Publish inspec-objects to GPR
run: npm publish mitre-inspec-objects-*.tgz
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 9b4403b

Please sign in to comment.