Merge pull request #185 from TU-Wien-dataLAB/ci/project-management-en… #1163
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: MAIN | |
on: | |
push: | |
tags: | |
- grader-service-* # for release_helm action | |
branches: | |
- main | |
pull_request: | |
types: [opened, synchronize, reopened] | |
release: | |
types: | |
- published | |
jobs: | |
init: | |
runs-on: ubuntu-latest | |
outputs: | |
changeDirs: ${{ steps.outputStep.outputs.changeDirs }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 2 | |
- name: Get changed dirs # To check if any files changed in a directory | |
id: changeDirsStep | |
uses: tj-actions/[email protected] | |
with: | |
dir_names: true | |
files: | | |
**/* | |
- id: outputStep | |
run: echo "::set-output name=changeDirs::${{ steps.changeDirsStep.outputs.all_changed_files }}" | |
# ON CHANGED FILES | |
build_grader-service: | |
uses: ./.github/workflows/build_service.yml | |
needs: init | |
if: contains(needs.init.outputs.changeDirs, 'grader_service') | |
dockerize_grader-service: | |
needs: build_grader-service | |
uses: ./.github/workflows/docker_service.yml | |
build_labextension: | |
uses: ./.github/workflows/build_labextension.yml | |
needs: init | |
if: contains(needs.init.outputs.changeDirs, 'grader_labextension') | |
dockerize_labextension: | |
needs: build_labextension | |
uses: ./.github/workflows/docker_labextension.yml | |
secrets: inherit | |
build_convert: | |
needs: init | |
if: contains(needs.init.outputs.changeDirs, 'grader_convert') | |
uses: ./.github/workflows/build_convert.yml | |
# docs: | |
# runs-on: ubuntu-latest | |
# steps: | |
# - uses: ./.github/workflows/reusable/build_docs | |
# ONLY ON MERGE SUCCEED | |
pre-release: | |
runs-on: ubuntu-latest | |
needs: | |
- dockerize_grader-service | |
- dockerize_labextension | |
- build_convert | |
if: always() && github.event.pull_request.merged == true && contains(needs.*.result, 'success') && !(contains(needs.*.result, 'failure')) | |
steps: | |
- name: TODO use correct version tags for pre-release | |
run: echo 'TODO use correct version tags for pre-release' | |
# ONLY ON RELEASES | |
release_helm: | |
needs: init | |
# both on grader-service and grader-service-chart release but not automatic helm release | |
if: startsWith(github.event.release.tag_name, 'grader-service') && !startsWith(github.event.release.tag_name, 'grader-service-helm') | |
uses: ./.github/workflows/publish_helm.yml | |
secrets: inherit | |
release_grader-service: | |
needs: dockerize_grader-service | |
# only on grader-service release but on grader-service-chart release nor automatic helm release | |
if: startsWith(github.event.release.tag_name, 'grader-service') && !startsWith(github.event.release.tag_name, 'grader-service-chart') && !startsWith(github.event.release.tag_name, 'grader-service-helm') | |
uses: ./.github/workflows/publish_service.yml | |
secrets: inherit | |
release_labextension: | |
needs: build_labextension | |
if: startsWith(github.event.release.tag_name, 'grader-labextension') | |
uses: ./.github/workflows/publish_labextension.yml | |
secrets: inherit | |
release_convert: | |
needs: build_convert | |
if: startsWith(github.event.release.tag_name, 'grader-convert') | |
uses: ./.github/workflows/publish_convert.yml | |
secrets: inherit |