From 0ad4ee88fc0d92e3245e1d0dacad2baf0d60ca0d Mon Sep 17 00:00:00 2001 From: Aoibhe Wilson Date: Wed, 16 Oct 2024 17:12:51 +0200 Subject: [PATCH] ci(meta): add release and publish actions --- .github/workflows/publish.yml | 30 +++++++++++++++++++++++ .github/workflows/release.yml | 45 +++++++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+) create mode 100644 .github/workflows/publish.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..deaf9db --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,30 @@ +name: Publish + +on: + release: + types: + - created + +jobs: + publish: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-java@v4 + with: + java-version: '11' + distribution: 'zulu' + server-id: github # Value of the distributionManagement/repository/id field of the pom.xml + settings-path: ${{ github.workspace }} # location for the settings.xml file + + - uses: gradle/actions/setup-gradle@v4 # v4.0.0 + + - name: Publish to GitHub Packages + run: ./gradlew publish -Prelease.useLastTag=true + env: + ORG_GRADLE_PROJECT_mavenPublishUser: ${{ github.actor }} + ORG_GRADLE_PROJECT_mavenPublishPassword: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..d2a4fb8 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,45 @@ +name: Release + +on: + push: + branches: + - main + tags-ignore: + - v[0-9]+.[0-9]+.[0-9]+ + +jobs: + publish: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-java@v4 + with: + java-version: '11' + distribution: 'zulu' + server-id: github # Value of the distributionManagement/repository/id field of the pom.xml + settings-path: ${{ github.workspace }} # location for the settings.xml file + + - uses: gradle/actions/setup-gradle@v4 # v4.0.0 + + - run: ./gradlew check + + - name: Create Changelog and Tag + uses: TriPSs/conventional-changelog-action@v5 + with: + github-token: ${{ secrets.github_token }} + preset: 'conventionalcommits' + output-file: 'docs/CHANGELOG.md' + skip-version-file: 'true' + + - name: Create Release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.github_token }} + with: + tag_name: ${{ steps.changelog.outputs.tag }} + release_name: ${{ steps.changelog.outputs.tag }} + body: ${{ steps.changelog.outputs.clean_changelog }}