64 lines
1.8 KiB
YAML
64 lines
1.8 KiB
YAML
name: Build & Publish
|
|
run-name: Feixiao weekly deploy
|
|
on:
|
|
push:
|
|
branches:
|
|
- root
|
|
schedule:
|
|
- cron: "0 0 * * 0"
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Disable SSL verify (Temporary Fix)
|
|
run: git config --global http.sslVerify false
|
|
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Set up QEMU
|
|
uses: docker/setup-qemu-action@v3
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Set up Java
|
|
uses: actions/setup-java@v4
|
|
|
|
with:
|
|
java-version: 21
|
|
distribution: temurin
|
|
|
|
- name: Get current date
|
|
id: date
|
|
run: echo "::set-output name=date::$(date +'%Y-%m-%d')"
|
|
|
|
- name: Grant execute permission for gradlew
|
|
run: chmod +x gradlew
|
|
|
|
- name: Gradle (Build)
|
|
run: "./gradlew build"
|
|
|
|
- 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
|