Skip to content

Release Daikoku

Release Daikoku #127

Workflow file for this run

name: Release Daikoku
on:
workflow_dispatch:
inputs:
lastVersion:
description: 'last version'
required: true
releaseVersion:
description: 'release version'
required: true
nextVersion:
description: 'next version'
required: true
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
# setup java to use sbt (?)
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '21'
- uses: coursier/cache-action@v5
# install node lts
- name: setup node
uses: actions/setup-node@v3
with:
node-version: '18.x'
cache: 'npm'
cache-dependency-path: daikoku/javascript/package-lock.json
#format sources
- name: format sources
id: fmt
run: |
sh ./scripts/build.sh fmt
echo "diff=$(git diff --numstat | wc -l)" >> $GITHUB_OUTPUT
- name: Commit formatted sources
if: steps.fmt.outputs.diff != '0'
run: |
git config --local user.email "[email protected]"
git config --local user.name "daikoku-github-actions"
git add --all
git commit -am "Format sources before release"
- name: Push formatted sources
if: steps.fmt.outputs.diff != '0'
uses: ad-m/github-push-action@master
with:
branch: ${{ github.ref }}
github_token: ${{ secrets.GITHUB_TOKEN}}
#Build manual with right version (and update version in openapi)
- name: update version number
id: version
run: |
find ./manual -type f -name '*.md' | xargs node ./scripts/version.js ${{ github.event.inputs.lastVersion }} ${{ github.event.inputs.releaseversion }}
find ./daikoku/public/swaggers -type f -name 'admin-api-openapi.*' -d 1 | xargs node ./scripts/version.js ${{ github.event.inputs.lastVersion }} ${{ github.event.inputs.releaseversion }}
echo "diff=$(git diff --numstat | wc -l)" >> $GITHUB_OUTPUT
- name: Commit formatted sources
if: steps.version.outputs.diff != '0'
run: |
git config --local user.email "[email protected]"
git config --local user.name "daikoku-github-actions"
git add --all
git commit -am "Update version number before release"
- name: build manual
id: manual
run: |
sh ./scripts/build.sh manual
echo "diff=$(git diff --numstat | wc -l)" >> $GITHUB_OUTPUT
cd ..
- name: Commit manual
if: steps.manual.outputs.diff != '0'
run: |
git config --local user.email "[email protected]"
git config --local user.name "daikoku-github-actions"
git add --all
git commit -am "Update documentation before release"
- name: Push manual
uses: ad-m/github-push-action@master
if: steps.manual.outputs.diff != '0'
with:
branch: ${{ github.ref }}
github_token: ${{ secrets.GITHUB_TOKEN}}
# release sbt (with auto commit tag)
- name: release sbt
run: |
git config --local user.email "[email protected]"
git config --local user.name "daikoku-github-actions"
cd daikoku
sbt "release release-version ${{ github.event.inputs.releaseVersion }} next-version ${{ github.event.inputs.nextVersion }}"
- name: push tag
uses: ad-m/github-push-action@master
with:
branch: ${{ github.ref }}
tags: true
github_token: ${{ secrets.GITHUB_TOKEN}}
- name: Checkout release tag
uses: actions/[email protected]
with:
ref: 'v${{ github.event.inputs.releaseVersion }}'
# clean, build doc and build DK
- name: Build DK
run: sh ./scripts/build.sh github
env:
NODE_OPTIONS: --max_old_space_size=4096
# create github release
- name: Create a Release
id: create_release
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ github.event.inputs.releaseversion }}
release_name: v${{ github.event.inputs.releaseversion }}
draft: false
# attach daikoku.jar, zip & manual.zip to github release
- name: Upload a Release Asset - daikoku.jar
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./daikoku/target/scala-2.13/daikoku.jar
asset_name: daikoku.jar
asset_content_type: application/octet-stream
- name: Upload a Release Asset - daikoku.zip
uses: actions/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./daikoku/target/universal/daikoku.zip
asset_name: daikoku-${{ github.event.inputs.releaseversion }}.zip
asset_content_type: application/octet-stream
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASSWORD }}
# build docker image & upload it in docker hub
- name: Build docker image
run: |
cd daikoku
sbt 'docker:publishLocal'
docker tag maif/daikoku:latest maif/daikoku:${{ github.event.inputs.releaseversion }}
docker push "maif/daikoku:latest"
docker push "maif/daikoku:${{ github.event.inputs.releaseversion }}"
# close milestone (with the latest release found)
- name: Close milestone
uses: adlerhsieh/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
REPO_OWNER: ${{ github.repository_owner }}
REPO: daikoku
IGNORE_MILESTONE_NOT_FOUND: true