Skip to content

release: 0.5.8

release: 0.5.8 #67

Workflow file for this run

name: 🎇 Deployer
on:
push:
branches:
- 'main'
jobs:
build:
name: build and set image
runs-on: ubuntu-latest
strategy:
matrix:
java-version: [ 21 ]
steps:
- name: checkout code
uses: actions/checkout@v3
with:
submodules: true
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: ${{ matrix.java-version }}
kotlin-version: ${{ matrix.kotlin-version }}
- name: Cache Gradle packages
uses: actions/cache@v3
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle
- name: build server
run: ./gradlew build -x test -DSENTRY_AUTH_TOKEN=${{ secrets.SENTRY_AUTH_TOKEN }}
- name: docker arm64 build set up - qemu
uses: docker/setup-qemu-action@v2
- name: docker arm64 build set up - buildx
uses: docker/setup-buildx-action@v2
- name: login github container registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: extract version
run: echo "##[set-output name=version;]$(echo '${{ github.event.head_commit.message }}' | egrep -o '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}')"
id: extract_version_name
- name: push
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/arm64/v8
push: true
tags: |
ghcr.io/depromeet/teum-teum-server/api:${{ steps.extract_version_name.outputs.version }}
build-args: |
"KAKAO_CLIENT_ID=${{ secrets.KAKAO_CLIENT_ID }}"
"KAKAO_CLIENT_SECRET=${{ secrets.KAKAO_CLIENT_SECRET }}"
"KAKAO_REDIRECT_URI=${{ secrets.KAKAO_REDIRECT_URI }}"
"NAVER_CLIENT_ID=${{ secrets.NAVER_CLIENT_ID }}"
"NAVER_CLIENT_SECRET=${{ secrets.NAVER_CLIENT_SECRET }}"
"NAVER_REDIRECT_URI=${{ secrets.NAVER_REDIRECT_URI }}"
"JWT_SECRET_KEY=${{ secrets.JWT_SECRET_KEY }}"
"DB_URL=${{ secrets.DB_URL }}"
"DB_USERNAME=${{ secrets.DB_USERNAME }}"
"DB_PASSWORD=${{ secrets.DB_PASSWORD }}"
"SENTRY_AUTH_TOKEN=${{ secrets.SENTRY_AUTH_TOKEN }}"
"GPT_TOKEN=${{ secrets.GPT_TOKEN }}"
"REDIS_HOST=${{ secrets.REDIS_HOST }}"
"REDIS_PORT=${{ secrets.REDIS_PORT }}"
"AWS_ACCESS_KEY=${{ secrets.AWS_ACCESS_KEY }}"
"AWS_SECRET_KEY=${{ secrets.AWS_SECRET_KEY }}"
"AWS_REGION=${{ secrets.AWS_REGION }}"
"AWS_S3_BUCKET=${{ secrets.AWS_S3_BUCKET }}"
- name: create release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.extract_version_name.outputs.version }}
release_name: ${{ steps.extract_version_name.outputs.version }}
deploy:
needs: build
name: deploy
runs-on: self-hosted
steps:
- name: extract version
run: echo "##[set-output name=version;]$(echo '${{ github.event.head_commit.message }}' | egrep -o '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}')"
id: extract_version_name
- name: run server
run: |
sudo docker pull ghcr.io/depromeet/teum-teum-server/api:${{ steps.extract_version_name.outputs.version }}
sudo docker ps -q --filter "expose=8080" | xargs sudo docker stop | xargs sudo docker rm
sudo docker run -d -p 8080:8080 ghcr.io/depromeet/teum-teum-server/api:${{ steps.extract_version_name.outputs.version }}