From d62c0efc514331286c38d7599c0e100425dd6f55 Mon Sep 17 00:00:00 2001 From: Salomon BRYS Date: Tue, 21 Nov 2023 16:16:44 +0100 Subject: [PATCH] First actions & workflows --- .editorconfig | 3 ++ .../create-nexus-staging-repository.yml | 27 +++++++++++++++ ...op-or-release-nexus-staging-repository.yml | 34 +++++++++++++++++++ setup/action.yml | 25 ++++++++++++++ 4 files changed, 89 insertions(+) create mode 100644 .editorconfig create mode 100644 .github/workflows/create-nexus-staging-repository.yml create mode 100644 .github/workflows/drop-or-release-nexus-staging-repository.yml create mode 100644 setup/action.yml diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..e3ed7d1 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,3 @@ +[*.yml] +indent_style = space +indent_size = 2 diff --git a/.github/workflows/create-nexus-staging-repository.yml b/.github/workflows/create-nexus-staging-repository.yml new file mode 100644 index 0000000..ea9e3f7 --- /dev/null +++ b/.github/workflows/create-nexus-staging-repository.yml @@ -0,0 +1,27 @@ +on: + workflow_call: + secrets: + SONATYPE_USERNAME: + required: true + SONATYPE_PASSWORD: + required: true + SONATYPE_PROFILE_ID: + required: true + outputs: + repository-id: ${{ jobs.create-staging-repository.outputs.repository-id }} + +jobs: + create-staging-repository: + name: Create Nexus staging repository + runs-on: ubuntu-latest + outputs: + repository-id: ${{ steps.create.outputs.repository_id }} + steps: + - id: create + uses: nexus-actions/create-nexus-staging-repo@v1 + with: + base_url: https://s01.oss.sonatype.org/service/local/ + username: ${{ secrets.SONATYPE_USERNAME }} + password: ${{ secrets.SONATYPE_PASSWORD }} + staging_profile_id: ${{ secrets.SONATYPE_PROFILE_ID }} + description: ${{ github.repository }}/${{ github.workflow }}#${{ github.run_number }} diff --git a/.github/workflows/drop-or-release-nexus-staging-repository.yml b/.github/workflows/drop-or-release-nexus-staging-repository.yml new file mode 100644 index 0000000..e775566 --- /dev/null +++ b/.github/workflows/drop-or-release-nexus-staging-repository.yml @@ -0,0 +1,34 @@ +on: + workflow_call: + inputs: + repository-id: + required: true + build-upload-result: + required: true + secrets: + SONATYPE_USERNAME: + required: true + SONATYPE_PASSWORD: + required: true + +jobs: + complete-staging-repository: + name: Complete Nexus staging repository + runs-on: ubuntu-latest + steps: + - name: Discard + if: ${{ input.build-upload-result != 'success' }} + uses: nexus-actions/drop-nexus-staging-repo@v1 + with: + base_url: https://s01.oss.sonatype.org/service/local/ + username: ${{ secrets.SONATYPE_USERNAME }} + password: ${{ secrets.SONATYPE_PASSWORD }} + staging_repository_id: ${{ inputs.repository-id }} + - name: Release + if: ${{ input.build-upload-result == 'success' }} + uses: nexus-actions/release-nexus-staging-repo@v1 + with: + base_url: https://s01.oss.sonatype.org/service/local/ + username: ${{ secrets.SONATYPE_USERNAME }} + password: ${{ secrets.SONATYPE_PASSWORD }} + staging_repository_id: ${{ inputs.repository-id }} diff --git a/setup/action.yml b/setup/action.yml new file mode 100644 index 0000000..1b97176 --- /dev/null +++ b/setup/action.yml @@ -0,0 +1,25 @@ +name: "Setup" +inputs: + java-version: + default: 17 + with-konan: + default: true +runs: + using: "composite" + steps: + - name: Check out + uses: actions/checkout@v4 + - name: Set up JDK Temurin ${{ inputs.java-version }} + uses: actions/setup-java@v3 + with: + distribution: temurin + java-version: ${{ inputs.java-version }} + - name: Setup Gradle + uses: gradle/gradle-build-action@v2 + - name: Cached Konan + if: ${{ inputs.with-konan }} + uses: actions/cache@v3 + with: + path: ~/.konan + key: ${{ runner.os }}-konan-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }} + restore-keys: ${{ runner.os }}-konan-