Development
: Add Helios-based deployment workflow for test servers
#47162
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: Build | |
on: | |
pull_request: | |
paths-ignore: | |
- 'README.md' | |
- 'CODE_OF_CONDUCT.md' | |
- 'CONTRIBUTING.md' | |
- 'LICENSE' | |
- 'SECURITY.md' | |
- 'docs/**' | |
- '.github/**' | |
- '!.github/workflows/build.yml' | |
- '!.github/workflows/testserver.yml' | |
push: | |
branches: | |
- develop | |
- main | |
- release/* | |
tags: '[0-9]+.[0-9]+.[0-9]+' | |
paths-ignore: | |
- 'README.md' | |
- 'CODE_OF_CONDUCT.md' | |
- 'CONTRIBUTING.md' | |
- 'LICENSE' | |
- 'SECURITY.md' | |
- 'docs/**' | |
- '.github/**' | |
- '!.github/workflows/build.yml' | |
release: | |
types: | |
- created | |
jobs: | |
define-inputs: | |
name: Define Inputs | |
runs-on: ubuntu-latest | |
outputs: | |
release_upload: ${{ steps.set-upload-release.outputs.release_upload }} | |
release_url: ${{ steps.set-upload-release.outputs.release_url }} | |
release_path: ${{ steps.set-upload-release.outputs.release_path }} | |
release_name: ${{ steps.set-upload-release.outputs.release_name }} | |
release_type: ${{ steps.set-upload-release.outputs.release_type }} | |
docker_build: ${{ steps.set-docker-build.outputs.docker_build }} | |
docker_ref: ${{ steps.set-docker-ref.outputs.docker_ref }} | |
docker_build_tag: ${{ steps.set-docker-tag.outputs.docker_build_tag }} | |
steps: | |
- name: Set Upload Release Artifact Outputs | |
id: set-upload-release | |
run: | | |
if [[ "${{ github.event_name }}" == "release" && "${{ github.event.action }}" == "created" ]]; then | |
echo "release_upload=true" >> $GITHUB_OUTPUT | |
echo "release_url=${{ github.event.release.upload_url }}" >> $GITHUB_OUTPUT | |
echo "release_path=build/libs/Artemis-${{ github.event.release.tag_name }}.war" >> $GITHUB_OUTPUT | |
echo "release_name=Artemis.war" >> $GITHUB_OUTPUT | |
echo "release_type=application/x-webarchive" >> $GITHUB_OUTPUT | |
else | |
echo "release_upload=false" >> $GITHUB_OUTPUT | |
fi | |
- name: Set Docker Build Flag | |
id: set-docker-build | |
run: | | |
if [[ ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'ls1intum/Artemis' }} ]]; then | |
echo "docker_build=true" >> $GITHUB_OUTPUT | |
else | |
echo "docker_build=false" >> $GITHUB_OUTPUT | |
fi | |
- name: Set Docker ref | |
if: ${{ steps.set-docker-build.outputs.docker_build == 'true' }} | |
id: set-docker-ref | |
run: | | |
if [[ "${{ github.event_name }}" == "pull_request" ]]; then | |
# Checkout pull request HEAD commit instead of merge commit | |
# this is done to include the correct branch and git information inside the build | |
echo "docker_ref=${{ github.event.pull_request.head.ref }}" >> $GITHUB_OUTPUT | |
elif [[ "${{ github.event_name }}" == "push" ]]; then | |
echo "docker_ref=${{ github.ref_name }}" >> $GITHUB_OUTPUT | |
fi | |
- name: Compute Tag | |
if: ${{ steps.set-docker-build.outputs.docker_build == 'true' }} | |
uses: actions/github-script@v7 | |
id: compute-tag | |
with: | |
result-encoding: string | |
script: | | |
if (context.eventName === "pull_request") { | |
return "pr-" + context.issue.number; | |
} | |
if (context.eventName === "release") { | |
return "latest"; | |
} | |
if (context.eventName === "push") { | |
if (context.ref.startsWith("refs/tags/")) { | |
return context.ref.slice(10); | |
} | |
if (context.ref === "refs/heads/develop") { | |
return "develop"; | |
} | |
} | |
return "FALSE"; | |
- name: Set Docker Build Tag | |
id: set-docker-tag | |
run: | | |
if [[ ${{ steps.compute-tag.outputs.result != 'FALSE' }} ]]; then | |
echo "docker_build_tag=${{ steps.compute-tag.outputs.result }}" >> $GITHUB_OUTPUT | |
fi | |
call-build-workflow: | |
name: Call Build Workflow | |
needs: define-inputs | |
uses: ./.github/workflows/reusable-build.yml | |
with: | |
build_war: true | |
release_upload: ${{ needs.define-inputs.outputs.release_upload == 'true' }} | |
release_url: ${{ needs.define-inputs.outputs.release_url }} | |
release_path: ${{ needs.define-inputs.outputs.release_path }} | |
release_name: ${{ needs.define-inputs.outputs.release_name }} | |
release_type: ${{ needs.define-inputs.outputs.release_type }} | |
docker: true | |
docker_ref: ${{ needs.define-inputs.outputs.docker_ref }} | |
docker_build_tag: ${{ needs.define-inputs.outputs.docker_build_tag }} |