Skip to content

Update on release notes and readme #19

Update on release notes and readme

Update on release notes and readme #19

Workflow file for this run

name: Release
on:
push:
tags:
- '*'
env:
REPO_NAME: ${{ github.event.repository.name }}
LOWCASE_REPO_NAME: ${{ github.repository_owner}}/heartbeat
jobs:
build_backend:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./backend
steps:
- uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: ${{ vars.JAVA_VERSION || 19 }}
distribution: "adopt"
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@v1
- name: Set up Gradle
uses: gradle/[email protected]
- name: Build
run: ./gradlew clean build
- uses: actions/upload-artifact@v3
with:
name: backend-app
path: backend/build/libs/heartbeat-backend-0.0.1-SNAPSHOT.jar
retention-days: ${{ vars.RETENTION_DAYS || 10 }}
build_frontend:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./frontend
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version: '16.x'
- name: Install
run: |
npm install -g pnpm
pnpm install --no-frozen-lockfile
- name: Lint
run: pnpm run lint
- name: Build
run: |
pnpm run build
- uses: actions/upload-artifact@v3
with:
name: frontend-app
path: frontend/dist
retention-days: ${{ vars.RETENTION_DAYS || 10 }}
build_and_push_image:
runs-on: ubuntu-latest
needs:
- build_frontend
- build_backend
steps:
- uses: actions/checkout@v4
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Get Tag name
run: |
echo "TAG_NAME=$(git tag --sort version:refname | tail -n 1)" >> "$GITHUB_ENV"
- name: Build and Push Docker Image for frontend
uses: docker/build-push-action@v5
with:
file: ./ops/infra/Dockerfile.frontend
push: true
tags: |
ghcr.io/${{ env.LOWCASE_REPO_NAME }}_frontend:${{ env.TAG_NAME }}
ghcr.io/${{ env.LOWCASE_REPO_NAME }}_frontend:latest
- name: Build and Push Docker Image for backend
uses: docker/build-push-action@v5
with:
file: ./ops/infra/Dockerfile.backend
push: true
tags: |
ghcr.io/${{ env.LOWCASE_REPO_NAME }}_backend:${{ env.TAG_NAME }}
ghcr.io/${{ env.LOWCASE_REPO_NAME }}_backend:latest
release:
runs-on: ubuntu-latest
needs:
- build_and_push_image
steps:
- uses: actions/checkout@v4
- name: Download frontend artifact
uses: actions/download-artifact@v3
with:
name: frontend-app
path: ./${{ env.REPO_NAME }}-frontend
- name: Download backend artifact
uses: actions/download-artifact@v3
with:
name: backend-app
- name: List
run: |
ls -a
- name: Release
id: build
run: |
mkdir ${{ env.REPO_NAME }}
mv ./${{ env.REPO_NAME }}-frontend ${{ env.REPO_NAME }}
mv heartbeat-backend-0.0.1-SNAPSHOT.jar ${{ env.REPO_NAME }}
zip -r ${{ env.REPO_NAME }}-$(git tag --sort version:refname | tail -n 1).zip ${{ env.REPO_NAME }}
ls
echo "TAG_NAME=$(git tag --sort version:refname | tail -n 1)" >> "$GITHUB_ENV"
- name: Upload zip file
uses: softprops/action-gh-release@v1
with:
files: ${{ env.REPO_NAME }}-${{ env.TAG_NAME }}.zip