Skip to content

Release

Release #15

Workflow file for this run

name: Release
on:
workflow_dispatch:
permissions:
contents: write
packages: write
jobs:
release:
name: Create Release
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
fetch-depth: 0
- name: Set up JDK 25
uses: actions/setup-java@f2beeb24e141e01a676f977032f5a29d81c9e27e # v5.1.0
with:
java-version: "25"
distribution: "sapmachine"
# Configure Gradle for optimal use in GiHub Actions, including caching of downloaded dependencies.
# See: https://github.com/gradle/actions/blob/main/setup-gradle/README.md
- name: Setup Gradle
uses: gradle/actions/setup-gradle@4d9f0ba0025fe599b4ebab900eb7f3a1d93ef4c2 # v5
- name: Determine Version to Release
id: version
run: echo "VERSION=$(date --utc +%Y.%m.%d)" >> $GITHUB_ENV
- name: Set Version for java app
run: echo $VERSION > version.txt
- name: Set Version index.html
run: sed -i "s/dev/$VERSION/g" src/main/resources/static/index.html
- name: Configure git
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
- name: Commit version.txt to branch
run: |
git checkout -b release-version-${VERSION}
git add version.txt src/main/resources/static/index.html
git commit -m "chore: set version to ${VERSION}"
git tag $VERSION
git push --tags origin release-version-${VERSION}
- name: Create Release
run: |
gh release create ${VERSION} --title "Release ${VERSION}" --notes "Release ${VERSION}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Start container with postgres for testing
run: docker compose --file unit-test-db-compose.yaml up --build --wait --detach
- name: Build with Gradle Wrapper
run: ./gradlew --no-daemon build asciidoctor
- name: Upload artifact
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
with:
name: build-artifacts
path: 'build'
container-image:
runs-on: ubuntu-24.04
needs:
- release
env:
IMAGE_NAME_ORG: gardenlinux
IMAGE_NAME: glvd-api
steps:
- name: Determine Version to Release
id: version
run: echo "VERSION=$(date --utc +%Y.%m.%d)" >> $GITHUB_ENV
- name: Checkout repo
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
ref: ${{ env.VERSION }}
- run: mkdir -p build
- name: Download built jar
uses: actions/download-artifact@37930b1c2abaa49bbe596cd826c3c89aef350131 # v7.0.0
with:
name: build-artifacts
path: build
- name: Install qemu dependency for multi-arch build
run: |
sudo apt-get update
sudo apt-get install -y qemu-user-static
- name: Build Image
id: build_image
uses: redhat-actions/buildah-build@7a95fa7ee0f02d552a32753e7414641a04307056 # v2.13
with:
image: ${{ env.IMAGE_NAME_ORG }}/${{ env.IMAGE_NAME }}
tags: ${{ env.VERSION }}
platforms: linux/amd64, linux/arm64
build-args: GLVD_VERSION=${{ env.VERSION }}
containerfiles: |
./Containerfile
- name: Echo Outputs
run: |
echo "Image: ${{ steps.build_image.outputs.image }}"
echo "Tags: ${{ steps.build_image.outputs.tags }}"
echo "Tagged Image: ${{ steps.build_image.outputs.image-with-tag }}"
- name: Check images created
run: buildah images | grep '${{ env.IMAGE_NAME }}'
- name: Check manifest
run: |
set -x
buildah manifest inspect ${{ steps.build_image.outputs.image }}:${{ env.VERSION }}
- name: Push To ghcr.io
id: push-to-ghcr
uses: redhat-actions/push-to-registry@5ed88d269cf581ea9ef6dd6806d01562096bee9c # v2.8
with:
image: ${{ steps.build_image.outputs.image }}
tags: ${{ steps.build_image.outputs.tags }}
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Log in to ghcr.io
uses: redhat-actions/podman-login@4934294ad0449894bcd1e9f191899d7292469603 # v1.7
with:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
registry: ghcr.io
- name: Build bare images
run: |
./build_bare.sh ghcr.io/${{ env.IMAGE_NAME_ORG }}/${{ env.IMAGE_NAME }} ${VERSION}
- name: Push bare images
id: bare
run: |
podman push --digestfile=bare-amd64-digest ghcr.io/${{ env.IMAGE_NAME_ORG }}/${{ env.IMAGE_NAME }}:${VERSION}-linuxamd64_bare
podman push ghcr.io/${{ env.IMAGE_NAME_ORG }}/${{ env.IMAGE_NAME }}:${VERSION}-linuxarm64_bare
echo "bare-amd64-digest=$(cat ./bare-amd64-digest)" >> $GITHUB_OUTPUT