1
0

65 lines
1.7 KiB
YAML

name: Build & Publish
on:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Java
uses: actions/setup-java@v4
with:
java-version: 21
distribution: temurin
- name: Gradle (Setup)
uses: gradle/actions/setup-gradle@v4
with:
dependency-graph: generate-and-submit
- name: Gradle (Build)
run: "./gradlew build"
- name: Upload artifacts (Main JAR)
uses: actions/upload-artifact@v4
with:
name: Main JAR
path: build/libs/*-all.jar
- name: Upload artifacts (JARs)
uses: actions/upload-artifact@v4
with:
name: JARs
path: build/libs/*.jar
- name: Login to DigitalOcean Registry
uses: docker/login-action@v3
with:
registry: registry.digitalocean.com
username: ${{ secrets.DOMAIL }}
password: ${{ secrets.DOKEY }}
- name: Build the Docker image
run: docker build -t registry.digitalocean.com/jansel/feixiao:latest -t registry.digitalocean.com/jansel/feixiao:${{ steps.date.outputs.date }} .
- name: Push the Docker image related to this workflow
run: docker push registry.digitalocean.com/jansel/feixiao:${{ steps.date.outputs.date }}
- name: Push the latest Docker image
run: docker push registry.digitalocean.com/jansel/feixiao:latest
- name: Remove the Docker image
run: docker rmi registry.digitalocean.com/jansel/feixiao:${{ steps.date.outputs.date }}
- name: Force remove the latest Docker image
run: docker rmi registry.digitalocean.com/jansel/feixiao:latest --force