diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..5e4251f --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,8 @@ +version: 2 +updates: + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "daily" + cooldown: + default-days: 7 diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d8b7e19..f4d6dd5 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,33 +1,77 @@ name: Maven CI - -on: - push: - branches: [ master ] - pull_request: - branches: [ master ] +on: [push, pull_request, workflow_dispatch] +permissions: {} jobs: build: runs-on: ubuntu-latest + timeout-minutes: 15 + steps: + - name: Checkout code + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + + - name: Set up Java + uses: actions/setup-java@b6effb05e454b25005698d916606bdc6ffcbf961 # v5.7.0 + with: + distribution: temurin + java-version: 25 + cache: maven + + - name: Build with Maven + run: mvn -B package + + - name: Upload artifacts + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 + with: + path: target/*.jar + if-no-files-found: error + archive: false + attestation: + if: github.event_name == 'push' || github.event_name == 'workflow_dispatch' + needs: build + runs-on: ubuntu-slim + timeout-minutes: 15 + permissions: + id-token: write + attestations: write steps: - - uses: actions/checkout@v4 - - uses: actions/setup-java@v4 - with: - distribution: 'temurin' - java-version: 25 - - - name: Cache maven packages to speed up build - uses: actions/cache@v4 - with: - path: ~/.m2 - key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }} - restore-keys: ${{ runner.os }}-m2 - - - name: Build with Maven - run: mvn -B package --file pom.xml - - - uses: actions/upload-artifact@v4 - with: - name: Extras - path: target/Extras.jar + - name: Download artifacts + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + path: dist/ + merge-multiple: true + + - name: Attest + uses: actions/attest@508db95dd578ae2727ebd6217d5ba78e4fbda05d # v4.2.1 + with: + subject-path: dist/ + + release: + if: github.event.repository.fork == false && github.ref_name == github.event.repository.default_branch + needs: attestation + runs-on: ubuntu-slim + timeout-minutes: 15 + permissions: + contents: write + env: + GITHUB_TOKEN: ${{ github.token }} + TAG_NAME: latest + steps: + - name: Checkout code + uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + persist-credentials: false + + - name: Download artifacts + uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1 + with: + path: dist/ + merge-multiple: true + + - name: Create release + run: | + gh release delete "$TAG_NAME" --cleanup-tag || true + gh release create "$TAG_NAME" --title "$TAG_NAME" --target "$GITHUB_SHA" dist/*.jar