j21 (#6) #35
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "Main: Build & deploy" | |
on: | |
workflow_dispatch: | |
push: | |
branches: [ "main" ] | |
permissions: | |
contents: read | |
jobs: | |
jar-build: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
outputs: | |
version: ${{steps.build.outputs.version}} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
token: ${{ github.token }} | |
- name: Set up JDK | |
uses: actions/setup-java@v4 | |
with: | |
java-version: '21' | |
distribution: 'zulu' | |
cache: 'maven' | |
- name: Build a jar | |
id: build | |
run: | | |
./mvnw -B -ntp versions:set -DnewVersion=$GITHUB_SHA | |
./mvnw -V -B -ntp clean package -Pprod -DskipTests | |
export VERSION=$(./mvnw -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec) | |
echo "version=${VERSION}" >> $GITHUB_OUTPUT | |
- name: Upload jar | |
uses: actions/upload-artifact@v4 | |
with: | |
name: kafbat-ui-${{ steps.build.outputs.version }} | |
path: api/target/api-${{ steps.build.outputs.version }}.jar | |
retention-days: 1 | |
docker-build: | |
needs: jar-build | |
permissions: | |
contents: read | |
uses: ./.github/workflows/docker_build.yml | |
secrets: inherit | |
with: | |
sha: ${{ github.sha }} | |
version: ${{ needs.jar-build.outputs.version }} | |
docker-deploy: | |
needs: [ jar-build, docker-build ] | |
permissions: | |
packages: write | |
id-token: write # Required to authenticate with OIDC for AWS | |
uses: ./.github/workflows/docker_publish.yml | |
secrets: inherit | |
with: | |
version: ${{ needs.jar-build.outputs.version }} | |
generic_tag: main |