Set actions/setup-java to use cache (#458) #217
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: Create Release | |
on: | |
push: | |
tags: [ '*.*.*.*' ] | |
branches: [ master ] | |
env: | |
SPARK_LOCAL_IP: 127.0.0.1 | |
jobs: | |
build: | |
name: Main | |
if: github.repository_owner == 'memiiso' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check Out Repo | |
uses: actions/checkout@v4 | |
- name: Set up JDK | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: 21 | |
cache: 'maven' | |
- name: Set env for master(latest) release | |
if: github.ref_name == 'master' | |
run: | | |
echo "RELEASE_NAME=latest" >> $GITHUB_ENV | |
- name: Set env for release | |
if: github.ref_name != 'master' | |
run: | | |
echo "RELEASE_NAME=${{ github.ref_name }}" >> $GITHUB_ENV | |
- name: Build project | |
run: mvn -B --no-transfer-progress package -Passembly --file pom.xml -Drevision=${{ env.RELEASE_NAME }} | |
- name: Delete previous ${{ env.RELEASE_NAME }} release | |
uses: dev-drprasad/[email protected] | |
with: | |
delete_release: true | |
tag_name: ${{ env.RELEASE_NAME }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Release | |
id: create_release | |
uses: softprops/action-gh-release@v2 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
name: Release ${{ env.RELEASE_NAME }} | |
tag_name: ${{ env.RELEASE_NAME }} | |
body: Release ${{ env.RELEASE_NAME }} | |
draft: false | |
prerelease: true | |
files: | | |
debezium-server-iceberg-sink/target/debezium-server-iceberg-sink-${{ env.RELEASE_NAME }}.jar | |
debezium-server-iceberg-dist/target/debezium-server-iceberg-dist-${{ env.RELEASE_NAME }}.zip | |
- name: Login to Github Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- uses: docker/build-push-action@v6 | |
name: Build & push Docker image | |
with: | |
context: ./ | |
file: ./Dockerfile | |
push: true | |
tags: ghcr.io/${{ github.repository_owner }}/debezium-server-iceberg:${{ env.RELEASE_NAME }} | |
- name: Delete all containers from repository without tags | |
uses: dylanratcliffe/delete-untagged-containers@main | |
with: | |
package_name: debezium-server-iceberg | |
token: ${{ secrets.GITHUB_TOKEN }} |