Merge pull request #19 from aws-samples/dependabot/npm_and_yarn/babel… #11
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Node.js Application | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
# These permissions are needed to interact with GitHub's OIDC Token endpoint. | |
permissions: | |
id-token: write | |
contents: read | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
max-parallel: 1 | |
matrix: | |
os: [ ubuntu-latest ] | |
node-version: [ 16 ] | |
steps: | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
role-to-assume: ${{ secrets.IAM_ROLE_TO_ASSUME }} | |
role-session-name: GitHub | |
aws-region: us-east-1 | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: '1' | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: Install dependencies | |
run: npm ci | |
- name: Build & Lint | |
run: npm run build | |
- name: Test | |
run: | | |
npm test | |
env: | |
AWS_REGION: us-east-1 | |
npm-publish: | |
name: npm-publish | |
needs: build | |
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: '1' | |
- name: Publish if version has been updated | |
uses: pascalgn/[email protected] | |
with: | |
tag_name: "v%s" | |
tag_message: "v%s" | |
create_tag: "true" | |
commit_pattern: "^Release (\\S+)" | |
workspace: "." | |
publish_command: "yarn" | |
publish_args: "--non-interactive" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Leave this as is, it's automatically generated | |
NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} |