Skip to content

Build For Release

Build For Release #6

Workflow file for this run

# This workflow will build a package using Maven and then publish it to GitHub packages when a release is created
# For more information see: https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#apache-maven-with-a-settings-path
# optional
name: Build For Release
on:
push:
tags:
- v*
workflow_dispatch:
inputs:
logLevel:
description: 'Log level'
required: true
default: 'info'
type: choice
options:
- debug
- info
- warning
- error
jobs:
build-release:
name: Release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: maven
- name: Build with Maven
run: mvn -B package --file pom.xml
- name: Upload JAR to Release
uses: svenstaro/upload-release-action@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
file: target/NyxBot.jar
asset-name: application.jar
tag: ${{ github.ref }}
overwrite: true
draft: true
- uses: release-drafter/release-drafter@v6
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
build-docker:
name: Docker
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
cache: maven
- name: Build with Maven
run: mvn -B package --file pom.xml
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Copy File
run: cp target/NyxBot.jar ./
- name: Build and push
run: |
docker build -t kingprimes/nyxbot:latest .
docker push kingprimes/nyxbot:latest