diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4159e74..4e2aac4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -6,30 +6,36 @@ on: pull_request: jobs: - buildPlugin: - uses: ./.github/workflows/buildPlugin.yml - repackageAndUploadArtifact: - name: Upload build artifact + build: + name: Build and upload plugin artifact runs-on: ubuntu-24.04 - needs: - - buildPlugin steps: - - name: Download plugin artifact - uses: actions/download-artifact@v4 + - name: Check out repository + uses: actions/checkout@v4 with: - name: ${{ needs.buildPlugin.outputs.artifactName }} - path: ${{ github.workspace }}/plugin - - name: Delete plugin artifact - uses: geekyeggo/delete-artifact@v5 + lfs: true + - name: Set up JDK 17 + uses: actions/setup-java@v4 with: - name: ${{ needs.buildPlugin.outputs.artifactName }} + java-version: 17 + distribution: adopt-hotspot + - name: Run Gradle Check # also ensures gradle is downloaded + run: | + chmod +x gradlew + ./gradlew check + - name: Set Variables + id: environment + shell: bash + run: echo "version=$(./gradlew printVersion --console=plain -q)" >> $GITHUB_OUTPUT + - name: Build plugin + run: ./gradlew buildPlugin - name: Unpack unsigned plugin for repackaging shell: bash run: | - cd ${{ github.workspace }}/plugin + cd ${{ github.workspace }}/build/distributions unzip *.zip -d pluginfiles - name: Upload built plugin uses: actions/upload-artifact@v4 with: - name: autoconfig-plugin-${{ needs.buildPlugin.outputs.version }} - path: plugin/pluginfiles/*/* \ No newline at end of file + name: autoconfig-plugin-${{ steps.environment.outputs.version }} + path: build/distributions/pluginfiles/*/* \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..9bacb77 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,41 @@ +name: Release + +on: + release: + types: + - published + +jobs: + build: + name: Build, sign and publish plugin + runs-on: ubuntu-24.04 + steps: + - name: Check out repository + uses: actions/checkout@v4 + with: + lfs: true + - name: Set up JDK 17 + uses: actions/setup-java@v4 + with: + java-version: 17 + distribution: adopt-hotspot + - name: Run Gradle Check # also ensures gradle is downloaded + run: | + chmod +x gradlew + ./gradlew check + - name: Set Variables + id: environment + shell: bash + run: | + echo "version=$(./gradlew printVersion --console=plain -q)" >> $GITHUB_OUTPUT + - name: Set release flag + id: release + shell: bash + run: echo "preRelease=${{ github.event.release.prerelease}}" >> $GITHUB_OUTPUT + - name: Build plugin + run: ./gradlew buildPlugin signPlugin publishPlugin -PpreRelease=${{ steps.release.outputs.preRelease }} + env: + CERTIFICATE_CHAIN: ${{ secrets.CERTIFICATE_CHAIN }} + PRIVATE_KEY: ${{ secrets.PRIVATE_KEY }} + PRIVATE_KEY_PASSWORD: ${{ secrets.PRIVATE_KEY_PASSWORD }} + PUBLISH_TOKEN: ${{ secrets.PUBLISH_TOKEN }} \ No newline at end of file diff --git a/build.gradle b/build.gradle index 05247f9..5af54f9 100644 --- a/build.gradle +++ b/build.gradle @@ -45,6 +45,12 @@ signPlugin { password = System.getenv("PRIVATE_KEY_PASSWORD") } +publishPlugin { + token = System.getenv("PUBLISH_TOKEN") + hidden = getProperty("hidden") + channels = getProperty("preRelease") ? ["autoconfig-beta"] : ["default", "autoconfig-beta"] +} + repositories { mavenCentral() } diff --git a/gradle.properties b/gradle.properties index 2dc9d8d..540f531 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,7 @@ # Autoconfig Plugin Properties pluginVersion = 0.0.2 +preRelease = false +hidden = true pluginGroup = de.gebit.plugins.autoconfig # IntelliJ Plugin Build Support