Skip to content

feat: v1.5

feat: v1.5 #160

Workflow file for this run

name: package
permissions:
contents: read
packages: write
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build_infra:
runs-on: ubuntu-latest
strategy:
matrix:
infra:
- nginx
- postgres
# - client
steps:
- uses: actions/checkout@v4
- name: "[build infra]"
run: |
cd ${{ matrix.infra }}
docker build -t ${{ matrix.infra }} .
build_service:
runs-on: ubuntu-latest
strategy:
matrix:
service:
- eureka-server
- upload-service
- extraction-service
- hashing-service
- search-service
- api-gateway
steps:
- uses: actions/checkout@v4
- name: "[setup java]"
if: matrix.service != 'client'
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
- name: "[cache gradle]"
if: matrix.service != 'client'
uses: actions/cache@v4
with:
path: ~/.gradle/caches
key: gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
- name: "[cache node modules]"
if: matrix.service == 'client'
uses: actions/cache@v4
with:
path: client/node_modules
key: node-${{ hashFiles('client/package-lock.json') }}
- name: "[build service]"
run: |
cd ${{ matrix.service }}
if [ "${{ matrix.service }}" == "client" ]; then
npm install
npm run build
else
./gradlew clean build
fi
- name: "[upload build artifact]"
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.service }}-build
path: |
${{ matrix.service }}/build/libs
${{ matrix.service }}/build/distributions
${{ matrix.service }}/dist
push_infra:
runs-on: ubuntu-latest
needs: build_infra
strategy:
matrix:
infra:
- nginx
- postgres
# - client
steps:
- uses: actions/checkout@v4
- name: "[login to ghcr]"
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: "[build_push (dev)]"
if: github.event_name == 'pull_request'
uses: ./.github/actions/build_push_infra
with:
infra: ${{ matrix.infra }}
env: dev
push: 'true'
- name: "[build_push (release)]"
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: ./.github/actions/build_push_infra
with:
infra: ${{ matrix.infra }}
env: prod
push: 'true'
push_service:
runs-on: ubuntu-latest
needs: build_service
strategy:
matrix:
service:
- eureka-server
- upload-service
- extraction-service
- hashing-service
- search-service
- api-gateway
steps:
- uses: actions/checkout@v4
- name: "[download build artifact]"
uses: actions/download-artifact@v4
with:
name: ${{ matrix.service }}-build
path: ${{ matrix.service }}
- name: "[login to ghcr]"
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: "[build_push (dev)]"
if: github.event_name == 'pull_request'
uses: ./.github/actions/build_push_service
with:
service: ${{ matrix.service }}
env: dev
push: 'true'
- name: "[build_push (release)]"
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: ./.github/actions/build_push_service
with:
service: ${{ matrix.service }}
env: prod
push: 'true'