2022-06-30 18:36:21 +02:00
|
|
|
# This workflow will build a Java project with Gradle
|
|
|
|
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle
|
|
|
|
|
|
|
|
name: Build Release
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
tags:
|
|
|
|
- "**"
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build-gradle:
|
|
|
|
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
2023-12-14 15:13:37 +01:00
|
|
|
- uses: actions/checkout@v4
|
2022-06-30 18:36:21 +02:00
|
|
|
|
|
|
|
- name: Set up JDK 17
|
|
|
|
uses: actions/setup-java@v3
|
|
|
|
with:
|
|
|
|
distribution: 'temurin'
|
|
|
|
java-version: 17
|
|
|
|
|
|
|
|
- name: Grant execute permission for gradlew
|
|
|
|
run: chmod +x gradlew
|
|
|
|
|
|
|
|
- name: Build with Gradle
|
|
|
|
run: ./gradlew build
|
|
|
|
|
|
|
|
- name: Upload Jar File
|
|
|
|
uses: actions/upload-artifact@v2-preview
|
|
|
|
with:
|
|
|
|
name: claptrap_jar
|
|
|
|
path: build/libs/
|
|
|
|
|
|
|
|
build-docker:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs:
|
|
|
|
- build-gradle
|
|
|
|
steps:
|
2023-12-14 15:13:37 +01:00
|
|
|
- uses: actions/checkout@v4
|
2022-06-30 18:36:21 +02:00
|
|
|
|
|
|
|
- name: Download artifact
|
|
|
|
uses: actions/download-artifact@v3.0.0
|
|
|
|
with:
|
|
|
|
# Artifact name
|
|
|
|
name: claptrap_jar
|
|
|
|
# Destination path
|
|
|
|
path: build/libs/
|
|
|
|
|
|
|
|
- name: Set up Docker Buildx
|
|
|
|
uses: docker/setup-buildx-action@v2
|
|
|
|
|
|
|
|
- name: Login to ghcr.io
|
|
|
|
uses: docker/login-action@v2
|
|
|
|
with:
|
|
|
|
registry: ghcr.io
|
|
|
|
username: ${{ github.repository_owner }}
|
|
|
|
password: ${{ secrets.CR_PAT }}
|
|
|
|
|
|
|
|
- name: Get branch name
|
|
|
|
id: branch-name
|
2022-07-01 09:40:57 +02:00
|
|
|
uses: tj-actions/branch-names@v5.4
|
2022-06-30 18:36:21 +02:00
|
|
|
|
|
|
|
- name: Set tag
|
|
|
|
run: |
|
|
|
|
echo "tag=${{ steps.branch-name.outputs.tag }}" >> $GITHUB_ENV
|
|
|
|
|
|
|
|
- name: Build and push Docker
|
|
|
|
uses: docker/build-push-action@v3
|
|
|
|
with:
|
|
|
|
push: true
|
|
|
|
context: .
|
|
|
|
tags: |
|
|
|
|
ghcr.io/sebclem/claptrapbot:${{ env.tag }}
|
|
|
|
ghcr.io/sebclem/claptrapbot:latest
|
|
|
|
file: ./Dockerfile
|