Skip to content

Publish a release

Publish a release #5

name: Publish a release
on:
workflow_dispatch:
inputs:
VERSION:
description: 'Version to release'
required: true
BRANCH:
description: 'Branch to use for release'
required: true
default: 'main'
type: choice
options:
- main
- mob/main
- release/1
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
ref: ${{ github.event.inputs.BRANCH }}
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
java-version: '21'
distribution: 'temurin'
cache: gradle
- name: Run Java backend tests
run: ./gradlew test
working-directory: api
- name: Build with Gradle
run: ./gradlew build
working-directory: api
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 20
- name: Cache pnpm
uses: actions/cache@v3
with:
path: |
ui/node_modules
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-pnpm-
- name: Install PNPM
run: |
npm --dd install @pnpm/exe
- name: Install UI Dependencies
run: ../node_modules/\@pnpm/exe/pnpm install --no-frozen-lockfile
working-directory: ui
- name: Lint with PNPM
run: ../node_modules/\@pnpm/exe/pnpm lint
working-directory: ui
- name: Run frontend tests
run: |
../node_modules/\@pnpm/exe/pnpm test
working-directory: ui
- name: Install and build with pnpm
run: |
../node_modules/\@pnpm/exe/pnpm build
tar --no-xattrs -czvf fe-dist.tar.gz dist
working-directory: ui
- name: release
uses: softprops/action-gh-release@v2
id: create_release
with:
draft: false
prerelease: ${{ github.event.inputs.BRANCH == 'mob/main' }}
name: ${{ github.event.inputs.VERSION }}
tag_name: ${{ github.event.inputs.VERSION }}
files: |
api/build/libs/rag-api.jar
ui/fe-dist.tar.gz
env:
GITHUB_TOKEN: ${{ github.token }}
- name: update release version
run: |
git config --local user.name actions-user
git config --local user.email "actions@github.com"
echo "export RELEASE_TAG=${{ github.event.inputs.VERSION }}" > release_version.txt
git add release_version.txt
if ! git diff --cached --quiet; then
git commit -m "Update release version to ${{ github.event.inputs.VERSION }}"
git push
else
echo "No changes to commit"
fi
working-directory: scripts
env:
GITHUB_TOKEN: ${{ github.token }}