Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split release workflow and fix publish part and add general test workflow CI #2

Merged
merged 1 commit into from
Apr 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 }}