Skip to content

Deploy

Deploy #5

Workflow file for this run

name: Deploy
on: workflow_dispatch
permissions:
packages: write
contents: write
env:
FLY_API_TOKEN: ${{ secrets.FLY_REGISTRY_TOKEN }}
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: main
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.ACTOR }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Setup flyctl
uses: superfly/flyctl-actions/setup-flyctl@master
- name: Increment version
uses: SOLIDSoftworks/semver-tags@v1.5.3
id: semver
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
default-version: '0.9.0'
- name: Build kamifusen
run: |
./gradlew build -Dquarkus.native.enabled=true -Dquarkus.package.jar.enabled=false \
-Dversion=${{ steps.semver.outputs.semantic-version }} \
&& echo "quarkus.http.auth.session.encryption-key=${{ secrets.AUTH_ENCRYPTION_KEY }}" >> src/main/resources/application.properties
- name: Build kamifusen native-micro image
run: |
docker build -f src/main/docker/Dockerfile.native-micro \
-t ghcr.io/tohuwabohu-io/kamifusen:${{ steps.semver.outputs.semantic-version }} .
- name: Push kamifusen jvm native-micro image to ghcr
run: docker push ghcr.io/tohuwabohu-io/kamifusen:${{ steps.semver.outputs.semantic-version }}
- name: Deploy kamifusen
run: |
flyctl deploy -a kamifusen -i \
ghcr.io/tohuwabohu-io/kamifusen:${{ steps.semver.outputs.semantic-version }} \
--image-label ${{ steps.semver.outputs.semantic-version }} --local-only --no-cache \
&& flyctl secrets set -a kamifusen --detach \
QUARKUS_DATASOURCE_PASSWORD=${{ secrets.DB_PWD }} \
QUARKUS_DATASOURCE_REACTIVE_URL=${{ secrets.DB_URL }} \
QUARKUS_DATASOURCE_USERNAME=${{ secrets.DB_USER }}
- name: Update kamifusen image version
run: |
flyctl image update -a kamifusen --image registry.fly.io/kamifusen:${{ steps.semver.outputs.semantic-version }} -y