add ci for renamed branch, to use in new infrastructure #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
name: CI | |
on: | |
push: | |
paths-ignore: | |
- 'client/**' | |
- '*.md' | |
pull_request: | |
paths-ignore: | |
- 'client/**' | |
- '*.md' | |
env: | |
PROJECT_NAME: odh-mobility-writer | |
DOCKER_IMAGE: ghcr.io/${{ github.repository }}/${{ github.event.repository.name }}-app | |
DOCKER_TAG: ${{ github.sha }} | |
JAVA_VERSION: '17' | |
jobs: | |
# Test | |
test: | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@v2 | |
- name: REUSE Compliance Check | |
uses: fsfe/reuse-action@v1 | |
- name: Test code | |
uses: noi-techpark/github-actions/maven-test@v2 | |
with: | |
java-version: ${{ env.JAVA_VERSION }} | |
test-command: 'mvn -B test' | |
# Deploy Test | |
build-renamed: | |
runs-on: ubuntu-22.04 | |
if: github.ref == 'refs/heads/renamed' | |
needs: test | |
concurrency: build-renamed | |
steps: | |
- name: Checkout source code | |
uses: actions/checkout@v2 | |
- name: Build project | |
uses: noi-techpark/github-actions/maven-build@v2 | |
with: | |
java-version: ${{ env.JAVA_VERSION }} | |
build-command: 'mvn -B -DskipTests -DfinalName=bdp --projects writer --also-make clean package' | |
- name: Build and push images | |
uses: noi-techpark/github-actions/docker-build-and-push@v2 | |
with: | |
docker-username: ${{ github.actor }} | |
docker-password: ${{ secrets.GITHUB_TOKEN }} | |
# https://github.com/shrink/actions-docker-registry-tag | |
- name: Add a "renamed" docker tag | |
uses: shrink/actions-docker-registry-tag@v2 | |
with: | |
registry: ghcr.io | |
repository: ${{ github.repository }}/${{ github.event.repository.name }}-app | |
target: ${{ env.DOCKER_TAG }} | |
tags: | | |
renamed |