Update dependency prebid/prebid-server-java to v3.17.0 (#51) #115
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 | |
# Controls when the workflow will run | |
on: | |
# Triggers the workflow on push or pull request events but only for the "main" branch | |
push: | |
branches: [ "main" ] | |
pull_request: | |
branches: [ "main" ] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: | |
# push image | |
packages: write | |
# for git tag & github release | |
contents: write | |
pull-requests: read | |
env: | |
OCI_REGISTRY: ghcr.io | |
DOCKER_IMAGE_NAME: yieldlab/prebid-server-java | |
steps: | |
- name: Checkout repo under /prebid-server-java-docker-image | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: '0' | |
path: prebid-server-java-docker-image | |
- name: Extract version | |
working-directory: ./prebid-server-java-docker-image | |
run: echo "TARGET_TAG=$(cat latest-release-version)" >> $GITHUB_ENV | |
- name: Check if version has already been released | |
working-directory: ./prebid-server-java-docker-image | |
run: git rev-list "$TARGET_TAG" > /dev/null 2>&1 && echo "TAG_ALREADY_EXISTS=1" >> $GITHUB_ENV || exit 0 | |
- name: Checkout prebid-server-java under /prebid | |
if: '!env.TAG_ALREADY_EXISTS' | |
uses: actions/checkout@v4 | |
with: | |
repository: 'prebid/prebid-server-java' | |
ref: ${{ env.TARGET_TAG }} | |
path: prebid-server-java | |
- name: Set up JDK 21 | |
if: '!env.TAG_ALREADY_EXISTS' | |
uses: actions/setup-java@v4 | |
with: | |
distribution: corretto | |
java-version: 21 | |
- name: Build application | |
if: '!env.TAG_ALREADY_EXISTS' | |
working-directory: ./prebid-server-java | |
run: ./mvnw --batch-mode -Dmaven.test.skip=true clean package | |
- name: Log in to the container registry | |
if: '!env.TAG_ALREADY_EXISTS' | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.OCI_REGISTRY }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push docker image | |
if: '!env.TAG_ALREADY_EXISTS' | |
uses: docker/build-push-action@v6 | |
with: | |
context: ./prebid-server-java | |
# push image only on main branch | |
push: ${{ (github.ref == 'refs/heads/main') }} | |
tags: ${{ env.OCI_REGISTRY }}/${{ env.DOCKER_IMAGE_NAME }}:${{ env.TARGET_TAG }} | |
- name: Add and push git tag | |
if: github.ref == 'refs/heads/main' && !env.TAG_ALREADY_EXISTS | |
working-directory: ./prebid-server-java-docker-image | |
run: | | |
git status | |
git config user.name CI | |
git config user.email "<>" | |
git tag -a --message='Release version ${{ env.TARGET_TAG }}' '${{ env.TARGET_TAG }}' | |
git checkout '${{ env.TARGET_TAG }}' | |
git show | |
git push origin tag -- '${{ env.TARGET_TAG }}' | |
- name: Create GitHub release | |
if: github.ref == 'refs/heads/main' && !env.TAG_ALREADY_EXISTS | |
uses: release-drafter/release-drafter@v6 | |
with: | |
config-name: release-drafter.yml | |
publish: true | |
name: "Release ${{ env.TARGET_TAG }}" | |
tag: ${{ env.TARGET_TAG }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |