c34cc41496
- Dockerfile multi-stage (build eclipse-temurin:25-jdk → runtime) - CI : tests via actions/setup-java puis build & push vers registry Gitea - Trigger Watchtower après push sur main - CLAUDE.md + rules projet (.claude/rules/) - Version build.gradle : 0.0.1-SNAPSHOT → 0.0.1 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
66 lines
1.7 KiB
YAML
66 lines
1.7 KiB
YAML
name: CI — Tests & Docker Build
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
- 'feat/**'
|
|
pull_request:
|
|
|
|
jobs:
|
|
test:
|
|
name: Tests
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Java 25
|
|
uses: actions/setup-java@v4
|
|
with:
|
|
distribution: temurin
|
|
java-version: '25'
|
|
|
|
- name: Lancer les tests
|
|
run: ./gradlew test --no-daemon
|
|
|
|
build-and-push:
|
|
name: Build & push image Docker
|
|
needs: test
|
|
runs-on: ubuntu-latest
|
|
if: github.ref == 'refs/heads/main'
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Lire la version depuis build.gradle
|
|
id: version
|
|
run: echo "VERSION=$(grep '^version' build.gradle | awk -F"'" '{print $2}')" >> $GITHUB_OUTPUT
|
|
|
|
- name: Setup Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Login registry Gitea
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: git.goutailler-olivier.com
|
|
username: ${{ secrets.REGISTRY_USER }}
|
|
password: ${{ secrets.REGISTRY_TOKEN }}
|
|
|
|
- name: Build & push image
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
file: Dockerfile
|
|
push: true
|
|
tags: |
|
|
git.goutailler-olivier.com/gato/olhar-api:latest
|
|
git.goutailler-olivier.com/gato/olhar-api:${{ steps.version.outputs.VERSION }}
|
|
|
|
- name: Trigger déploiement Watchtower
|
|
run: |
|
|
wget -q --post-data='' \
|
|
--header="Authorization: Bearer ${{ secrets.WATCHTOWER_TOKEN }}" \
|
|
https://watchtower.goutailler-olivier.com/v1/update \
|
|
-O /dev/null
|