-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from CourseOrchestra/docker
Docker
- Loading branch information
Showing
13 changed files
with
210 additions
and
35 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
|
||
All workflows that will be called before pr should be called from ci-pr.yml. | ||
All workflows that will be called after pushing to main should be called from ci-push.yml. | ||
|
||
Tests, linters and other quality assurance for module should run inside of workflow named "quality-assurance.yml". | ||
Building and deploying artifact logic for module should run inside of workflow named "deploy.yml". | ||
|
||
For version validation you should specify version obtaining logic in .vuh file. |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
name: ci | ||
|
||
on: | ||
pull_request: | ||
branches: [ main ] | ||
|
||
jobs: | ||
|
||
validate-version: | ||
name: Validate version | ||
uses: ./.github/workflows/validate-current-version.yml | ||
with: | ||
VUH_VERSION: 'v2.9.2' | ||
|
||
quality-assurance-api: | ||
name: Quality assurance | ||
uses: ./.github/workflows/quality-assurance.yml | ||
needs: validate-version |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
name: ci | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
|
||
jobs: | ||
|
||
deploy: | ||
name: Deploy mellophone2 | ||
uses: ./.github/workflows/deploy.yml | ||
with: | ||
VUH_VERSION: 'v2.9.2' | ||
secrets: | ||
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }} | ||
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
release-notes-generation: | ||
name: Release generation | ||
uses: ./.github/workflows/release-notes-generation.yml | ||
with: | ||
VUH_VERSION: 'v2.9.2' | ||
CHANGELOG_GENERATOR_VERSION: 'v1.0.2' | ||
needs: [deploy] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,58 @@ | ||
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time | ||
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven | ||
|
||
name: ci-mellophone2-prod | ||
name: Deploy mellophone2 | ||
|
||
# Triggers the workflow on push or pull request events but only for the master branch | ||
on: | ||
push: | ||
branches: [ main ] | ||
workflow_call: | ||
inputs: | ||
VUH_VERSION: { required: true, type: string } | ||
secrets: | ||
DOCKER_USERNAME: | ||
required: true | ||
DOCKER_PASSWORD: | ||
required: true | ||
|
||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | ||
jobs: | ||
# This workflow contains a single job called "build" | ||
build: | ||
|
||
name: Deploy mellophone2 | ||
runs-on: ubuntu-latest | ||
|
||
environment: deployenv | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
uses: actions/checkout@v4 | ||
- name: Download vuh | ||
run: | | ||
curl https://raw.githubusercontent.com/Greewil/version-update-helper/${{ inputs.VUH_VERSION }}/vuh.sh -O -J -L | ||
chmod +x vuh.sh | ||
- name: Get release version | ||
id: artifact_version | ||
run: | | ||
cur_version=$(./vuh.sh lv -q) | ||
echo "release version: $cur_version" | ||
echo "VERSION=$cur_version" >> "$GITHUB_OUTPUT" | ||
- name: Set up JDK 17 enviroment on ubuntu-latest... | ||
uses: actions/setup-java@v2 | ||
with: | ||
java-version: '17' | ||
distribution: 'temurin' | ||
cache: maven | ||
|
||
- name: Build mellophone2 with maven | ||
run: mvn clean package | ||
- name: Extract pom project version | ||
run: echo ::set-output name=version::$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec) | ||
id: projectversiongroup | ||
- uses: papeloto/action-zip@v1 | ||
with: | ||
files: | ||
target/mellophone2-${{ steps.projectversiongroup.outputs.version }}.jar | ||
target/mellophone2-${{ steps.artifact_version.outputs.VERSION }}.jar | ||
target/classes/application.yml | ||
target/classes/config/config.xml | ||
dest: ./artifact_for_ftp/mellophone2-${{ steps.projectversiongroup.outputs.version }}.zip | ||
dest: ./artifact_for_ftp/mellophone2-${{ steps.artifact_version.outputs.VERSION }}.zip | ||
- name: Archive production artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: mellophone2-${{ steps.projectversiongroup.outputs.version }} | ||
path: ./artifact_for_ftp/mellophone2-${{ steps.projectversiongroup.outputs.version }}.zip | ||
name: mellophone2-${{ steps.artifact_version.outputs.VERSION }} | ||
path: ./artifact_for_ftp/mellophone2-${{ steps.artifact_version.outputs.VERSION }}.zip | ||
|
||
- name: 📂 Upload artifact to ftp | ||
uses: SamKirkland/[email protected] | ||
with: | ||
|
@@ -49,19 +61,21 @@ jobs: | |
password: ${{ secrets.FTP_CURS_PWD }} | ||
server-dir: development/curs-mellophone2/ | ||
local-dir: ./artifact_for_ftp/ | ||
- name: Build docker image | ||
run: | | ||
docker build -t curs/mellophone2 . | ||
- name: Log in to Docker Hub | ||
|
||
- name: Login to container registry (to Docker Hub) | ||
if: success() && github.ref == 'refs/heads/main' | ||
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
- name: Push | ||
- name: Build and push | ||
if: success() && github.ref == 'refs/heads/main' | ||
run: | | ||
docker push curs/mellophone2:latest | ||
uses: docker/build-push-action@v6 | ||
with: | ||
push: true | ||
tags: curs/mellophone2:latest , curs/mellophone2:${{ steps.artifact_version.outputs.VERSION }} | ||
context: . | ||
|
||
- name: Build documentation | ||
run: | | ||
./_builddoc.sh | ||
|
14 changes: 8 additions & 6 deletions
14
.github/workflows/ci-mellophone2-pr.yml → .github/workflows/quality-assurance.yml
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,30 @@ | ||
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time | ||
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven | ||
|
||
name: ci-mellophone2-pr | ||
name: Quality Assurance API | ||
|
||
on: | ||
pull_request: | ||
branches: [ main ] | ||
workflow_call: | ||
|
||
jobs: | ||
build: | ||
|
||
name: Quality Assurance API | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up JDK 17 enviroment on ubuntu-latest... | ||
uses: actions/setup-java@v2 | ||
with: | ||
java-version: '17' | ||
distribution: 'temurin' | ||
cache: maven | ||
- name: Build mellophone2 with maven | ||
|
||
- name: Build mellophone2 with maven and run tests | ||
run: mvn clean test | ||
|
||
- name: Build documentation | ||
run: | | ||
./_builddoc.sh |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
name: Release generation | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
VUH_VERSION: { required: true, type: string } | ||
CHANGELOG_GENERATOR_VERSION: { required: true, type: string } | ||
|
||
jobs: | ||
|
||
generate_release_from_new_commits: | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- name: Git clone this repo | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: download vuh | ||
run: | | ||
curl https://raw.githubusercontent.com/Greewil/version-update-helper/${{ inputs.VUH_VERSION }}/vuh.sh -O -J -L | ||
chmod +x vuh.sh | ||
- name: download release notes generator | ||
run: | | ||
curl https://raw.githubusercontent.com/Greewil/release-notes-generator/${{ inputs.CHANGELOG_GENERATOR_VERSION }}/gen_release_notes.sh -O -J -L | ||
chmod +x gen_release_notes.sh | ||
- name: get release tag_name | ||
id: release_tag | ||
run: | | ||
cur_version=$(./vuh.sh lv -q) | ||
[ "$cur_version" != '' ] || exit 1 | ||
echo "release version: $cur_version" | ||
echo "RELEASE_TAG=$cur_version" >> "$GITHUB_OUTPUT" | ||
- name: generate release notes | ||
id: changelog | ||
run: | | ||
./gen_release_notes.sh -i .. -lt -f changelog.md | ||
[ -f "changelog.md" ] && CHANGELOG=$(cat changelog.md) || CHANGELOG='' | ||
echo "$CHANGELOG" | ||
echo 'FINAL_CHANGELOG<<EOF' >> $GITHUB_OUTPUT | ||
echo "$CHANGELOG" >> $GITHUB_OUTPUT | ||
echo 'EOF' >> $GITHUB_OUTPUT | ||
[ -f 'changelog.md' ] && echo "IS_EMPTY=false" >> "$GITHUB_OUTPUT" | ||
[ -f 'changelog.md' ] || echo "IS_EMPTY=true" >> "$GITHUB_OUTPUT" | ||
- name: Create Release | ||
uses: actions/create-release@v1 | ||
if: ${{ steps.changelog.outputs.IS_EMPTY == 'false' }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: "${{ steps.release_tag.outputs.RELEASE_TAG }}" | ||
release_name: "${{ steps.release_tag.outputs.RELEASE_TAG }}" | ||
body: ${{ steps.changelog.outputs.FINAL_CHANGELOG }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: Check new version is greater than main version | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
VUH_VERSION: { required: true, type: string } | ||
|
||
jobs: | ||
|
||
validate-version: | ||
name: Check new version is greater than main version | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Download vuh | ||
run: | | ||
curl https://raw.githubusercontent.com/Greewil/version-update-helper/${{ inputs.VUH_VERSION }}/vuh.sh -O -J -L | ||
chmod +x vuh.sh | ||
- name: Compare versions | ||
run: | | ||
./vuh.sh sv -q && [ "$(./vuh.sh lv -q)" = "$(./vuh.sh sv -q)" ] || exit 1 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# This is version update helper config. | ||
# It contains specific to current project variables. With use of this file vuh understands how to extract project's | ||
# version and where project's version variable is located. Vuh can't work with any project without this file! | ||
# If .vuh file located in comparing branch is different from local .vuh file vuh will by default take | ||
# configuration files from handling branches (f.e. local .vuh to work with local version and origin/main:.vuh | ||
# to work with origin/main's version). If your project dont have .vuh file in project's root folder vuh will advice | ||
# you to configure that project. | ||
# | ||
# (Version update helper's page: https://github.com/Greewil/version-update-helper) | ||
|
||
# This configuration file is based on project-config-templates/xml-versions-template. | ||
|
||
MAIN_BRANCH_NAME='main' | ||
VERSION_FILE='pom.xml' | ||
TEXT_BEFORE_VERSION_CODE='<version>' | ||
TEXT_AFTER_VERSION_CODE='<\/version>' |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
server: | ||
port: 8082 | ||
ssl: | ||
enabled: false | ||
|
||
|
||
mellophone: | ||
|
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
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