Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

- fixes an issue where the validation workflow would not be using the matrix parameter - merged build and publish workflows as they are similar - formatting #480

Merged
merged 2 commits into from
Jan 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 44 additions & 24 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ name: Node.js CI
on:
workflow_dispatch:
push:
branches: [ dev ]
branches: [dev]
pull_request:
branches: [ dev ]
branches: [dev]

jobs:
build:
Expand All @@ -19,31 +19,33 @@ jobs:

strategy:
matrix:
node-version: [16.x, 18.x, 20.x]
node-version: [18.x, 20.x]
# Single version should work for compilation testing

steps:
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
- run: npm ci
- run: npm run build
- name: Check for Secret availability
id: my-key-check
# perform secret check & put boolean result as an output
shell: bash
run: |
if [ "${{ secrets.client_secret }}" != '' ]; then
echo "defined=true" >> $GITHUB_OUTPUT;
else
echo "defined=false" >> $GITHUB_OUTPUT;
fi
- run: npm run test
if: steps.my-key-check.outputs.defined == 'true'
env:
TENANT_ID: ${{secrets.tenant_id}}
CLIENT_ID: ${{secrets.client_id}}
CLIENT_SECRET: ${{secrets.client_secret}}
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm run build
- name: Check for Secret availability
id: my-key-check
# perform secret check & put boolean result as an output
shell: bash
run: |
if [ "${{ secrets.client_secret }}" != '' ]; then
echo "defined=true" >> $GITHUB_OUTPUT;
else
echo "defined=false" >> $GITHUB_OUTPUT;
fi
- run: npm run test
if: steps.my-key-check.outputs.defined == 'true'
env:
TENANT_ID: ${{secrets.tenant_id}}
CLIENT_ID: ${{secrets.client_id}}
CLIENT_SECRET: ${{secrets.client_secret}}

# The check-build-matrix returns success if all matrix jobs in build are successful; otherwise, it returns a failure.
# Use this as a PR status check for GitHub Policy Service instead of individual matrix entry checks.
Expand All @@ -58,3 +60,21 @@ jobs:
- name: One or more build matrix options failed
if: ${{ contains(needs.*.result, 'failure') }}
run: exit 1

publish-npm:
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/dev' }}
needs: build
environment:
name: production_feed
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
registry-url: https://registry.npmjs.org/
- run: npm ci
- run: npm run build
- run: npm publish --access public
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
45 changes: 0 additions & 45 deletions .github/workflows/publish-to-npm.yml

This file was deleted.