Skip to content

Commit

Permalink
Merge pull request #2 from conduktor/fix-release-ci
Browse files Browse the repository at this point in the history
Split release workflow and fix publish part and add general test workflow CI
  • Loading branch information
qboileau authored Apr 11, 2024
2 parents e2487ea + ce0eca0 commit 368464a
Show file tree
Hide file tree
Showing 3 changed files with 72 additions and 36 deletions.
25 changes: 25 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: CI

on:
push:
branches:
- main
pull_request:
types: [ opened, reopened, synchronize ]


jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'

- name: Test
run: mvn test
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Create release
run-name: Create release ${{ inputs.version }} on ${{ github.sha }} by @${{ github.actor }}
name: Prepare release
run-name: Prepare release ${{ inputs.version }} on ${{ github.sha }} by @${{ github.actor }}

on:
workflow_dispatch:
Expand Down Expand Up @@ -56,37 +56,3 @@ jobs:
mvn --batch-mode release:prepare -DreleaseVersion=${{ env.RELEASE_VERSION }} -DdevelopmentVersion=${{ inputs.next }} -Dtag=${{ env.RELEASE_VERSION }} --file pom.xml
env:
GITHUB_TOKEN: ${{ secrets.CONDUKTORBOT_REPO_WRITE }}

publish-release:
runs-on: ubuntu-latest
needs: create-release
permissions:
contents: write
steps:
- name: Checkout tag ${{ env.RELEASE_VERSION }}
uses: actions/checkout@v4
with:
ref: ${{ env.RELEASE_VERSION }}

- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'

- name: maven-settings
uses: s4u/maven-settings-action@v2
with:
servers: '[{"id": "github", "username": "conduktorbot", "password": "${{ secrets.CONDUKTORBOT_GHCR_RW }}" }]'
githubServer: false

- name: Deploy
run: mvn -DskipTests deploy

- name: Create Github Release
uses: ncipollo/release-action@v1
with:
name: "${{ env.RELEASE_VERSION }}"
tag: ${{ env.RELEASE_VERSION }}
artifacts: "target/azure-kafka-oauthbearer-*.jar"
token: ${{ secrets.GITHUB_TOKEN }}
45 changes: 45 additions & 0 deletions .github/workflows/publish_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Publish release
run-name: Publish release ${GITHUB_REF#refs/*/} on ${{ github.sha }} by @${{ github.actor }}

on:
push:
tags:
- '*'
workflow_dispatch:

jobs:
publish-release:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Get the Github Release version
run: |
ref=${GITHUB_REF#refs/*/}
git show-ref --verify refs/tags/${ref} || { echo "Ref ${GITHUB_REF} is not a tag" ; exit 1; }
echo "RELEASE_VERSION=${ref}" >> "$GITHUB_ENV"
- name: Checkout tag ${{ env.RELEASE_VERSION }}
uses: actions/checkout@v4
with:
ref: ${{ env.RELEASE_VERSION }}

- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'temurin'

- name: Deploy
run: mvn -DskipTests --batch-mode deploy
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Create Github Release
uses: ncipollo/release-action@v1
with:
name: "${{ env.RELEASE_VERSION }}"
tag: ${{ env.RELEASE_VERSION }}
artifacts: "target/azure-kafka-oauthbearer-*.jar"
token: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 368464a

Please sign in to comment.