Skip to content

build(deps): bump the npm_and_yarn group with 2 updates #1458

build(deps): bump the npm_and_yarn group with 2 updates

build(deps): bump the npm_and_yarn group with 2 updates #1458

Workflow file for this run

# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: 5e SRD API CI/CD
on:
push:
branches: [main]
pull_request:
branches: [main]
repository_dispatch:
types: [build_application]
env:
REGISTRY: ghcr.io
jobs:
unit:
name: Run tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js 18.x
uses: actions/setup-node@v4
with:
node-version: 18.x
- run: npm install
- run: npm run test:unit
lint:
name: Run linter
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js 18.x
uses: actions/setup-node@v4
with:
node-version: 18.x
- run: npm install
- run: npm run lint
integration:
name: Run Integration tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npm run test:integration:local
deploy:
name: Trigger Heroku Deploy
runs-on: ubuntu-latest
needs: [unit, integration, lint]
if: ${{ github.ref == 'refs/heads/main' && github.repository == '5e-bits/5e-srd-api' }}
steps:
- uses: actions/checkout@v4
- uses: akhileshns/[email protected]
with:
heroku_api_key: ${{secrets.HEROKU_API_KEY}}
heroku_app_name: 'dnd-5e-srd-api'
heroku_email: '[email protected]'
github-release:
name: Github Release
runs-on: ubuntu-latest
needs: [deploy]
if: ${{ github.event_name == 'push' && github.repository == '5e-bits/5e-srd-api' }}
outputs:
new_release_published: ${{ steps.semantic.outputs.new_release_published}}
version: ${{ steps.semantic.outputs.new_release_version }}
steps:
- name: Checkout latest code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Semantic Release
id: semantic
uses: cycjimmy/semantic-release-action@v4
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
container-release:
name: Container Release
runs-on: ubuntu-latest
needs: [github-release]
if: ${{needs.github-release.outputs.new_release_published == 'true' && github.repository == '5e-bits/5e-srd-api'}}
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
uses: docker/build-push-action@v6
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ needs.github-release.outputs.version }},${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
labels: version=${{ needs.github-release.outputs.version }}