From e1c12466646d926da11064d8e196d722c81f0894 Mon Sep 17 00:00:00 2001 From: Martin Mauch Date: Mon, 12 Jan 2026 23:43:37 +0100 Subject: [PATCH] Update publishing workflow --- .github/workflows/ci.yml | 90 +++++++++++++++++++++++++++++++++++ .github/workflows/publish.yml | 26 ---------- 2 files changed, 90 insertions(+), 26 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..ba07791 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,90 @@ +name: Continuous Integration + +on: + pull_request: + branches: ['**'] + push: + branches: ['**'] + tags: [v*] + +env: + PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }} + SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} + SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} + PGP_SECRET: ${{ secrets.PGP_SECRET }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + +jobs: + build: + name: Build and Test + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup Java + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: 17 + + - name: Cache Mill + uses: actions/cache@v4 + with: + path: | + ~/.mill + ~/.cache/coursier/v1 + key: ${{ runner.os }}-mill-${{ hashFiles('build.mill') }} + restore-keys: | + ${{ runner.os }}-mill- + + - name: Compile + run: ./mill mill-docker.compile + + - name: Test + run: ./mill mill-docker.test + + publish: + name: Publish Artifacts + needs: [build] + if: github.event_name != 'pull_request' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main') + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup Java + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: 17 + + - name: Cache Mill + uses: actions/cache@v4 + with: + path: | + ~/.mill + ~/.cache/coursier/v1 + key: ${{ runner.os }}-mill-${{ hashFiles('build.mill') }} + restore-keys: | + ${{ runner.os }}-mill- + + - name: Import GPG Key + uses: crazy-max/ghaction-import-gpg@v6 + with: + gpg_private_key: ${{ secrets.PGP_SECRET }} + passphrase: ${{ secrets.PGP_PASSPHRASE }} + trust_level: 5 + + - name: Publish to Sonatype Central + run: | + export GPG_TTY=$(tty) + ./mill -i mill.scalalib.SonatypeCentralPublishModule/ \ + --username $SONATYPE_USERNAME \ + --password $SONATYPE_PASSWORD \ + --gpgArgs "--passphrase=$PGP_PASSPHRASE,--no-tty,--pinentry-mode,loopback,--batch,--yes,-a,-b" \ + --bundleName com.ofenbeck-mill-docker-$(date +%Y-%m-%d-%H-%M) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml deleted file mode 100644 index 4edb675..0000000 --- a/.github/workflows/publish.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: Publish to Sonatype Central - -on: - push: - tags: - - 'v*' - workflow_dispatch: - -jobs: - publish: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - - uses: actions/setup-java@v4 - with: - distribution: 'temurin' - java-version: '17' - - - name: Publish to Sonatype Central - env: - MILL_SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} - MILL_SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} - MILL_PGP_SECRET_BASE64: ${{ secrets.PGP_SECRET_BASE64 }} - MILL_PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }} - run: ./mill mill-docker.publishSonatypeCentral \ No newline at end of file