v0.18.0 #31
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: REST Server - Create a release | |
####################################### | |
# This creates a NubesGen REST server release: | |
# - An executable Jar file | |
# - A JVM-based Docker image | |
# - A native (GraalVM) Docker image | |
# - It deploys the native (GraalVM) Docker image to the production environment | |
####################################### | |
on: | |
release: | |
types: [published] | |
jobs: | |
build_jar: | |
name: Build and publish Jar file | |
runs-on: ubuntu-22.04 | |
defaults: | |
run: | |
working-directory: ${{ github.workspace }}/rest-server | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'oracle' | |
java-version: '23' | |
check-latest: false | |
cache: 'maven' | |
- name: Package the application | |
run: ./mvnw package | |
- name: Upload binaries to release | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: rest-server/target/*.jar | |
file_glob: true | |
tag: ${{ github.ref }} | |
build_docker_image_native: | |
name: Build and publish Docker image to GitHub Packages | |
runs-on: ubuntu-22.04 | |
env: | |
DOCKER_IMAGE_NAME: 'docker.pkg.github.com/microsoft/nubesgen/nubesgen-native' | |
steps: | |
- name: Set Tag name environment variable | |
run: echo "TAG_NAME=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- uses: graalvm/setup-graalvm@v1 | |
with: | |
distribution: 'graalvm' | |
java-version: '23' | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
cache: 'maven' | |
- name: Build application with GraalVM | |
run: | | |
cd rest-server && ./mvnw -Pnative native:compile | |
- name: Login to GitHub Packages | |
run: docker login -u ${{ github.actor }} -p ${{ secrets.GITHUB_TOKEN }} docker.pkg.github.com | |
- name: Build the native (GraalVM) Docker image | |
uses: docker/build-push-action@v6 | |
with: | |
push: false | |
tags: ${{ env.DOCKER_IMAGE_NAME }}:${{ env.TAG_NAME }},${{ env.DOCKER_IMAGE_NAME }}:latest | |
file: ./rest-server/src/main/docker/Dockerfile.native | |
context: ./rest-server/ | |
- name: Push to GitHub Packages | |
run: docker push ${{ env.DOCKER_IMAGE_NAME }} --all-tags | |
deploy: | |
name: Deploy to production on https://nubesgen.com | |
environment: prod | |
runs-on: ubuntu-22.04 | |
needs: [build_docker_image_native] | |
env: | |
DOCKER_IMAGE_NAME: 'ghcr.io/microsoft/nubesgen/nubesgen-native' | |
steps: | |
- name: Set Tag name environment variable | |
run: echo "TAG_NAME=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV | |
- name: Login to Azure | |
uses: azure/login@v2 | |
with: | |
creds: ${{ secrets.AZURE_CREDENTIALS }} | |
- name: Deploy to Container App | |
uses: azure/CLI@v2 | |
with: | |
inlineScript: | | |
az config set extension.use_dynamic_install=yes_without_prompt | |
az containerapp update \ | |
-n ${{ vars.APPLICATION_NAME }} \ | |
-g ${{ vars.RESOURCE_GROUP_NAME }} \ | |
--image ${{ env.DOCKER_IMAGE_NAME }}:${{ env.TAG_NAME }} |