Skip to content

Commit

Permalink
build: adding action to release and publish
Browse files Browse the repository at this point in the history
  • Loading branch information
Benj0s committed May 7, 2024
1 parent dc640d2 commit 1fd2609
Show file tree
Hide file tree
Showing 6 changed files with 354 additions and 4,750 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/app.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: App

on: [push, pull_request]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Get npm cache directory
id: npm-cache-dir
shell: bash
run: echo "dir=$(npm config get cache)" >> ${GITHUB_OUTPUT}

- uses: actions/cache@v4
id: npm-cache
with:
path: ${{ steps.npm-cache-dir.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: 'npm'

- name: npm install and build
run: |
npm ci
npm run build --if-present
npm test
env:
CI: true
38 changes: 0 additions & 38 deletions .github/workflows/nodejs.yml

This file was deleted.

43 changes: 43 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: release-please

on:
push:
branches:
- main

permissions:
contents: write
pull-requests: write

jobs:
release-please:
runs-on: ubuntu-latest

steps:
- uses: google-github-actions/release-please-action@v4
with:
release-type: node
package-name: dc-integration-middleware
token: ${{ secrets.GH_REPO_ACCESS }}

- uses: actions/checkout@v4
if: ${{ steps.release.outputs.release_created }}

- uses: actions/setup-node@v4
if: ${{ steps.release.outputs.release_created }}
with:
cache: 'npm'
node-version-file: '.nvmrc'
registry-url: 'https://registry.npmjs.org'

- name: Install & build
if: ${{ steps.release.outputs.release_created }}
run: |
npm ci
npm run build --if-present
- name: Publish to npm
if: ${{ steps.release.outputs.release_created }}
run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
16
Loading

0 comments on commit 1fd2609

Please sign in to comment.