Skip to content

feat: first release #40

feat: first release

feat: first release #40

name: Build and Deploy
on:
push:
branches:
- main
jobs:
build:
name: Release new semantic version
runs-on: ubuntu-latest
outputs:
didRelease: ${{ steps.semver.outputs.new_release_published }}
newVersion: ${{ steps.semver.outputs.new_release_version }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
token: ${{ secrets.GHCR_PAT }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install dependencies
run: npm ci
- name: Build application
run: npm run build
- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: build
path: ./build
- name: semantic-release
uses: cycjimmy/semantic-release-action@v4
id: semver
env:
GITHUB_TOKEN: ${{ secrets.GHCR_PAT }}
publish:
name: Build Docker image
needs: build
if: needs.build.outputs.didRelease == 'true'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
token: ${{ secrets.GHCR_PAT }}
- name: Download build artifacts
uses: actions/download-artifact@v3
with:
name: build
path: ./build
- name: Log download path
run: echo ${{ steps.download.outputs.download-path }}
- name: List directory contents
run: ls -la
- name: Log in to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GHCR_PAT }}
- name: Build and push
uses: docker/build-push-action@v4
with:
context: ./
push: true
tags: ghcr.io/${{ github.repository }}:${{ needs.build.outputs.newVersion }}