2020-04-12 17:20:46 +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
|
|
|
|
|
2020-04-12 18:57:37 +02:00
|
|
|
name: Build
|
2020-04-12 17:20:46 +02:00
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
2022-06-30 18:36:21 +02:00
|
|
|
branches-ignore:
|
|
|
|
- "renovate/**"
|
|
|
|
tags-ignore:
|
|
|
|
- "**"
|
2020-04-12 17:20:46 +02:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
build-gradle:
|
|
|
|
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
2022-06-30 18:36:21 +02:00
|
|
|
- uses: actions/checkout@v3
|
2021-02-18 15:21:59 +01:00
|
|
|
|
2022-05-15 16:40:00 +02:00
|
|
|
- name: Set up JDK 17
|
2022-06-30 18:36:21 +02:00
|
|
|
uses: actions/setup-java@v3
|
2020-04-12 17:20:46 +02:00
|
|
|
with:
|
2022-06-30 18:36:21 +02:00
|
|
|
distribution: 'temurin'
|
2022-05-15 16:40:00 +02:00
|
|
|
java-version: 17
|
2021-02-18 15:21:59 +01:00
|
|
|
|
2020-04-12 17:20:46 +02:00
|
|
|
- name: Grant execute permission for gradlew
|
|
|
|
run: chmod +x gradlew
|
2021-02-18 15:21:59 +01:00
|
|
|
|
2020-04-12 17:20:46 +02:00
|
|
|
- name: Build with Gradle
|
|
|
|
run: ./gradlew build
|
2021-02-18 15:21:59 +01:00
|
|
|
|
2020-04-12 17:20:46 +02:00
|
|
|
- name: Upload Jar File
|
|
|
|
uses: actions/upload-artifact@v2-preview
|
|
|
|
with:
|
|
|
|
name: claptrap_jar
|
|
|
|
path: build/libs/
|
2021-02-16 12:30:04 +01:00
|
|
|
|
2020-04-12 17:20:46 +02:00
|
|
|
build-docker:
|
2022-05-15 16:40:00 +02:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs:
|
|
|
|
- build-gradle
|
2020-04-12 17:20:46 +02:00
|
|
|
steps:
|
2022-06-30 18:36:21 +02:00
|
|
|
- uses: actions/checkout@v3
|
2021-02-18 15:21:59 +01:00
|
|
|
|
2020-04-12 17:20:46 +02:00
|
|
|
- name: Download artifact
|
2022-06-30 18:36:21 +02:00
|
|
|
uses: actions/download-artifact@v3.0.0
|
2020-04-12 17:20:46 +02:00
|
|
|
with:
|
|
|
|
# Artifact name
|
|
|
|
name: claptrap_jar
|
|
|
|
# Destination path
|
|
|
|
path: build/libs/
|
2021-02-18 15:21:59 +01:00
|
|
|
|
|
|
|
- name: Set up Docker Buildx
|
2022-06-30 18:36:21 +02:00
|
|
|
uses: docker/setup-buildx-action@v2
|
2021-02-18 15:21:59 +01:00
|
|
|
|
|
|
|
- name: Login to ghcr.io
|
2022-06-30 18:36:21 +02:00
|
|
|
uses: docker/login-action@v2
|
2021-02-18 15:21:59 +01:00
|
|
|
with:
|
|
|
|
registry: ghcr.io
|
|
|
|
username: ${{ github.repository_owner }}
|
|
|
|
password: ${{ secrets.CR_PAT }}
|
|
|
|
|
2022-06-29 16:43:29 +02:00
|
|
|
- name: Get branch name
|
|
|
|
id: branch-name
|
2022-06-30 18:36:21 +02:00
|
|
|
uses: tj-actions/branch-names@v5.3
|
2022-06-29 16:43:29 +02:00
|
|
|
|
|
|
|
- name: Set tag
|
|
|
|
run: |
|
|
|
|
echo "tag=${{ steps.branch-name.outputs.current_branch }}" >> $GITHUB_ENV
|
|
|
|
|
2021-02-18 15:21:59 +01:00
|
|
|
- name: Build and push Docker
|
2022-06-30 18:36:21 +02:00
|
|
|
uses: docker/build-push-action@v3
|
2020-04-12 17:20:46 +02:00
|
|
|
with:
|
2021-02-18 15:21:59 +01:00
|
|
|
push: true
|
|
|
|
context: .
|
2022-06-29 16:43:29 +02:00
|
|
|
tags: "ghcr.io/sebclem/claptrapbot:${{ env.tag }}"
|
|
|
|
file: ./Dockerfile
|