Bump docker/build-push-action from 5 to 6 (#173) #101
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 ] | |
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 17 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: 17 | |
- 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 clean package -Passembly --file pom.xml -Drevision=${{ env.RELEASE_NAME }} | |
- name: Delete previous ${{ env.RELEASE_NAME }} release | |
uses: dev-drprasad/delete-tag-and-release@v1.0.1 | |
with: | |
delete_release: true # default: false | |
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: false | |
files: debezium-server-bigquery-dist/target/debezium-server-bigquery-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-bigquery:${{ env.RELEASE_NAME }} | |
- name: Delete all containers from repository without tags | |
uses: dylanratcliffe/delete-untagged-containers@main | |
with: | |
package_name: debezium-server-bigquery | |
token: ${{ secrets.GITHUB_TOKEN }} |