diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..e21e9fb --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,57 @@ +name: ci + +on: + workflow_dispatch: + push: + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up JDK + uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: '17' + + - name: Build with Maven + run: mvn clean package + + release: + runs-on: ubuntu-latest + needs: [build] + if: github.ref == 'refs/heads/main' + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Set up JDK + uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: '17' + + - name: Publish package [on main] + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + mvn deploy -DskipTests -Drevision=1.0.${{ github.run_number }} -Denv=mysql + + - uses: actions/delete-package-versions@v4 + with: + package-name: 'com.github.binpastes.app' + package-type: 'maven' + min-versions-to-keep: 10 + - uses: actions/delete-package-versions@v4 + with: + package-name: 'com.github.binpastes.frontend' + package-type: 'maven' + min-versions-to-keep: 10 + - uses: actions/delete-package-versions@v4 + with: + package-name: 'com.github.binpastes.backend' + package-type: 'maven' + min-versions-to-keep: 10 diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml deleted file mode 100644 index e5403d2..0000000 --- a/.github/workflows/main.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: CI - -on: [push] - -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - - - name: Set up JDK - uses: actions/setup-java@v3 - with: - distribution: 'temurin' - java-version: '17' - - - name: Build with Maven - run: mvn clean package - - - name: Publish package [on main] - if: github.ref == 'refs/heads/main' - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - mvn deploy -DskipTests -Denv=mysql - - - uses: actions/delete-package-versions@v4 - if: github.ref == 'refs/heads/main' - with: - package-name: 'com.github.binpastes.binpastes' - package-type: 'maven' - min-versions-to-keep: 10 - ignore-versions: '1.0.0-SNAPSHOT' diff --git a/.gitignore b/.gitignore index b416b6a..481726f 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ target/ !.mvn/wrapper/maven-wrapper.jar !**/src/main/**/target/ !**/src/test/**/target/ +pom.xml.versionsBackup ### STS ### .apt_generated diff --git a/README.md b/README.md index 1f770f8..c0291c5 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # BinPastes -[![Java CI](https://github.com/querwurzel/BinPastes/actions/workflows/main.yml/badge.svg)](https://github.com/querwurzel/BinPastes/actions/workflows/main.yml) +[![CI](https://github.com/querwurzel/BinPastes/actions/workflows/ci.yml/badge.svg)](https://github.com/querwurzel/BinPastes/actions/workflows/ci.yml) My turn on creating a simple pastebin. diff --git a/backend/pom.xml b/backend/pom.xml index 2a5a7c9..f4a6dc1 100644 --- a/backend/pom.xml +++ b/backend/pom.xml @@ -6,8 +6,8 @@ com.github.binpastes - binpastes - 1.0.0-SNAPSHOT + app + ${revision} ../pom.xml @@ -17,6 +17,7 @@ com.github.binpastes frontend + ${revision} diff --git a/frontend/pom.xml b/frontend/pom.xml index 4cec7af..3a53426 100644 --- a/frontend/pom.xml +++ b/frontend/pom.xml @@ -6,8 +6,8 @@ com.github.binpastes - binpastes - 1.0.0-SNAPSHOT + app + ${revision} ../pom.xml diff --git a/pom.xml b/pom.xml index 0d7ec5a..4dd75e9 100644 --- a/pom.xml +++ b/pom.xml @@ -11,8 +11,8 @@ com.github.binpastes - binpastes - 1.0.0-SNAPSHOT + app + ${revision} pom BinPastes @@ -31,6 +31,7 @@ UTF-8 + 1.0.0-SNAPSHOT 17