Skip to content

Commit

Permalink
Merge pull request #6 from Coaktion/chore/add-reusable-workflows
Browse files Browse the repository at this point in the history
chore: add reusable workflows
  • Loading branch information
inaciogu authored Dec 12, 2023
2 parents aa1d77b + a759450 commit 5fe164c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 73 deletions.
51 changes: 5 additions & 46 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,50 +4,9 @@ on:
release:
types: [published]

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}

permissions:
contents: read
packages: write

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
- run: npm ci
- run: npm test

publish-github:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
registry-url: https://npm.pkg.github.com/
- run: npm ci
- run: npm publish

publish-npm:
if: ${{ vars.OPEN_SOURCE == 'true' }}
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
registry-url: https://registry.npmjs.org/
- run: |
sed -i 's/npm.pkg.github.com/registry.npmjs.org/g' package.json
sed -i 's/npm.pkg.github.com/registry.npmjs.org/g' .npmrc
sed -i 's/GITHUB_TOKEN/NPM_TOKEN/g' .npmrc
- run: npm ci
- run: npm publish
publish:
uses: "Coaktion/aktie-devops/.github/workflows/npm-publish.yml@main"
with:
open_source: true
secrets: inherit
28 changes: 1 addition & 27 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,6 @@ on:
branches:
- main

permissions:
contents: read

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x, 18.x]

steps:
- uses: actions/checkout@v3

- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}

- name: Install Node Modules
run: npm ci

- name: NPM Audit
run: npx audit-ci

- name: Run Tests and Linting
run: npm test
uses: "Coaktion/aktie-devops/.github/workflows/test.yml@main"

0 comments on commit 5fe164c

Please sign in to comment.