Skip to content

Commit

Permalink
project: add workflows; version now 1.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
lokka30 committed Nov 23, 2024
1 parent 99b0c00 commit b6d4e33
Show file tree
Hide file tree
Showing 3 changed files with 107 additions and 1 deletion.
34 changes: 34 additions & 0 deletions .github/workflows/mvn-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: Java CI with Maven

on:
push:
pull_request:

jobs:
build:

runs-on: ubuntu-latest

permissions:
contents: read

steps:
- uses: actions/checkout@v4

- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
cache: maven

- name: Build with Maven
run: mvn --batch-mode clean
72 changes: 72 additions & 0 deletions .github/workflows/mvn-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven

# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: Java CI with Maven

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

on:
release:
types: [ published ]

jobs:
build-publish:

runs-on: ubuntu-latest

permissions:
contents: write
packages: write
attestations: write
id-token: write

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'
cache: maven

- name: Build and deploy with Maven
run: mvn --batch-mode deploy --settings settings.xml
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- uses: AButler/[email protected]
with:
files: "lachsbot/target/lachsbot.jar"
repo-token: ${{ secrets.GITHUB_TOKEN }}

- name: Login to GitHub CR
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Extract Metadata
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Build and Push
uses: docker/build-push-action@v6
with:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<artifactId>lachsbot</artifactId>
<groupId>space.lachy.lachsbot</groupId>
<version>1.0-SNAPSHOT</version>
<version>1.0.1-SNAPSHOT</version>
<packaging>jar</packaging>

<name>lachsbot</name>
Expand Down

0 comments on commit b6d4e33

Please sign in to comment.