CI updates and bump operator version #92
Workflow file for this run
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: minimal-app | |
on: | |
workflow_dispatch: | |
pull_request: | |
paths: | |
- minimal-app/** | |
- .github/workflows/minimal-app.yml | |
- .github/workflows/scripts | |
push: | |
branches: | |
- main | |
paths: | |
- minimal-app/** | |
env: | |
WORKING_DIR: ./minimal-app | |
JAVA_VERSION: 17 | |
GIT_TAG_PREFIX: minimal-app_v | |
jobs: | |
verify-versions: | |
if: github.ref != 'refs/heads/main' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- run: sh .github/workflows/scripts/verify_minimal_app_releasable.sh | |
name: Verify minimal app is in a state to be released on merge | |
build: | |
name: build image | |
if: github.ref != 'refs/heads/main' | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: bash | |
working-directory: ${{ env.WORKING_DIR }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-java@v3 | |
with: | |
java-version: "${{ env.JAVA_VERSION }}" | |
distribution: "temurin" | |
- run: mvn --batch-mode --update-snapshots verify | |
name: build image | |
release: | |
if: github.ref == 'refs/heads/main' | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: bash | |
working-directory: ${{ env.WORKING_DIR }} | |
permissions: | |
contents: write # create git tags | |
packages: write # push docker images | |
steps: | |
- uses: actions/checkout@v4 | |
- run: | | |
VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) | |
REGISTRY=$(mvn help:evaluate -Dexpression=docker.registry -q -DforceStdout) | |
IMAGE_NAME=$(mvn help:evaluate -Dexpression=image-name -q -DforceStdout) | |
echo "REGISTRY=$REGISTRY" >> "$GITHUB_OUTPUT" | |
echo "TAG_NAME=${{ env.GIT_TAG_PREFIX }}$VERSION" >> "$GITHUB_OUTPUT" | |
echo "FULL_IMAGE_NAME=$REGISTRY/$IMAGE_NAME:$VERSION" >> "$GITHUB_OUTPUT" | |
cat $GITHUB_OUTPUT | |
id: naming-selector | |
name: generate names for artifacts | |
- run: | | |
git fetch --tags | |
if git rev-parse -q --verify "refs/tags/${{ steps.naming-selector.outputs.TAG_NAME }}"; then | |
# confirm image exists | |
docker manifest inspect ${{ steps.naming-selector.outputs.FULL_IMAGE_NAME }} | |
else | |
echo "needs_release=true" >> $GITHUB_ENV | |
fi | |
name: check if release is needed | |
- uses: actions/setup-java@v3 | |
if: env.needs_release == 'true' | |
with: | |
java-version: "${{ env.JAVA_VERSION }}" | |
distribution: "temurin" | |
- run: mvn --batch-mode --update-snapshots verify | |
if: env.needs_release == 'true' | |
name: build image | |
- uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 | |
if: env.needs_release == 'true' | |
with: | |
registry: ${{ steps.naming-selector.outputs.REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- run: docker push ${{ steps.naming-selector.outputs.FULL_IMAGE_NAME }} | |
if: env.needs_release == 'true' | |
- uses: mathieudutour/[email protected] | |
if: env.needs_release == 'true' | |
id: tag_version | |
with: | |
custom_tag: ${{ steps.naming-selector.outputs.TAG_NAME }} | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
# avoid v prefix before tag | |
tag_prefix: "" |