name: Build & Publish on: workflow_dispatch: push: branches: - root jobs: build: runs-on: ubuntu-latest steps: - uses: https://github.com/actions/checkout@v4 - name: Set up QEMU uses: https://github.com/docker/setup-qemu-action@v3 - name: Set up Docker Buildx uses: https://github.com/docker/setup-buildx-action@v3 - name: Set up Java uses: https://github.com/actions/setup-java@v4 with: java-version: 21 distribution: temurin - name: "Restore Cache" id: restore-cache uses: https://data.forgejo.org/actions/cache/restore@v4 with: path: "~/.gradle/caches,~/.gradle/wrapper,~/.m2/repository" key: gradle-store - name: Grant execute permission for gradlew run: chmod +x gradlew with: dependency-graph: generate-and-submit cache-disabled: true - name: Get current date id: date run: echo "::set-output name=date::$(date +'%Y-%m-%d')" - name: Gradle (Build) run: "./gradlew build" - name: Login to DigitalOcean Registry uses: https://github.com/docker/login-action@v3 with: registry: registry.digitalocean.com username: ${{ secrets.DOMAIL }} password: ${{ secrets.DOKEY }} - name: Build and push uses: https://github.com/docker/build-push-action@v6 with: context: . platforms: linux/amd64,linux/arm64 push: true tags: registry.digitalocean.com/jansel/feixiao:latest,registry.digitalocean.com/jansel/feixiao:${{ steps.date.outputs.date }} - name: "Save Cache" uses: https://data.forgejo.org/actions/cache/save@v4 with: path: ~/.gradle/caches,~/.gradle/wrapper,~/.m2/repository key: ${{ steps.restore-cache.outputs.cache-primary-key }}