Merge pull request #126 from Team-Fruit/dev #29
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: Release and Publish Docker image | |
on: | |
push: | |
tags: | |
- 'v*.*.*' | |
jobs: | |
release_and_publish: | |
runs-on: ubuntu-latest | |
steps: | |
# Check out the repository | |
- name: Check out the repo | |
uses: actions/checkout@v4 | |
# Setup JDK 17 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '17' | |
distribution: 'corretto' | |
cache: maven | |
# Build with Maven | |
- name: Build with Maven | |
run: mvn -B package --file pom.xml | |
# Create GitHub Release | |
- name: Create Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
files: target/eewbot-*.jar | |
# Setup QEMU | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
# Setup Docker Buildx | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
# Login to DockerHub | |
- name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
# Login to GitHub Container Registry | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
# Docker meta | |
- name: Docker meta | |
uses: docker/metadata-action@v5 | |
id: meta | |
with: | |
images: | | |
teamfruit/eewbot | |
ghcr.io/${{ github.repository }} | |
tags: | | |
type=ref,event=branch | |
type=ref,event=pr | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
# Build and push Docker image | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} |