Release Daikoku #124
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: 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 11 | |
uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: '11' | |
- uses: coursier/cache-action@v5 | |
# install node 16 | |
- name: setup node | |
uses: actions/setup-node@v1 | |
with: | |
node-version: '16' | |
#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 | |
# - name: build manual | |
# id: manual | |
# run: | | |
# find ./manual/src/main/paradox -type f -name '*.md' | xargs node ./scripts/version.js ${{ github.event.inputs.lastVersion }} ${{ github.event.inputs.releaseversion }} | |
# find ./docs -type f -name '*.html' -d 1 | xargs node ./scripts/version.js ${{ github.event.inputs.lastVersion }} ${{ github.event.inputs.releaseversion }} | |
# cd manual | |
# sbt "release with-defaults release-version ${{ github.event.inputs.releaseversion }}" | |
# cd .. | |
# 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 with-defaults 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 }}' | |
- name: Get yarn cache directory path | |
id: yarn-cache-dir-path | |
run: | | |
echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT | |
- name: CACHE ACTION | |
uses: actions/cache@v2 | |
env: | |
cache-version: v1 | |
id: yarn-cache | |
with: | |
path: | | |
${{ steps.yarn-cache-dir-path.outputs.dir }} | |
**/node_modules | |
key: ${{ runner.os }}-yarn-${{ env.cache-version }}-${{ hashFiles('**/yarn.lock') }} | |
restore-keys: | | |
${{ runner.os }}-yarn-${{ env.cache-version }}- | |
${{ runner.os }}-yarn- | |
${{ runner.os }}- | |
# 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: Zip manual | |
run: zip -r ./daikoku-manual.zip ./docs/manual -x '*.DS_Store' | |
- name: Upload a Release Asset - manual | |
uses: actions/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./daikoku-manual.zip | |
asset_name: daikoku-manual-${{ 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 | |