ci(workflow): combine relase and build-package workflow #2
Workflow file for this run
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: "Create Release" | ||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- "main" | ||
permissions: | ||
contents: read | ||
jobs: | ||
build: | ||
name: Build SpringBooot-Jar | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
- name: Build bootJar | ||
run: | | ||
./gradlew :monitor:bootJar | ||
- name: Upload Artifact | ||
uese: actions/upload-artifact@v4 | ||
with: | ||
name: bootjar | ||
path: monitor/build/libs/monitor.jar | ||
if-no-files-found: error | ||
overwrite: true | ||
release: | ||
name: Generate Release | ||
runs-on: ubuntu-latest | ||
needs: | ||
- build | ||
permissions: | ||
contents: write | ||
issues: write | ||
pull-requests: write | ||
outputs: | ||
release_tag: ${{ steps.release.outputs.tag }} | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Get SpringBoot-Jar | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: bootjar | ||
path: monitor/build/libs/ | ||
- name: Install Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
cache: npm | ||
node-version: "lts/*" | ||
- name: Install NodeJS Dependencies | ||
run: npm clean-install | ||
- name: Verify the integrity and registry signatures for dependencies | ||
run: npm audit signatures | ||
- name: Create Release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: npx semantic-release | ||
- name: Get Release Version | ||
id: release | ||
uses: GuillaumeFalourd/get-release-or-tag@v2 | ||
publish_package: | ||
name: Publish runtime as Maven Package | ||
runs-on: ubuntu-latest | ||
needs: | ||
- release | ||
permissions: | ||
- packages: write | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v4 | ||
- name: Push Package | ||
env: | ||
ACTOR: ${{ github.actor }} | ||
TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
TAG: ${{ needs.release.outputs.release_tag }} | ||
run: | | ||
./gradlew -Pversion=$TAG :runtime:publish | ||
publish_container_image: | ||
name: Publish Monitor as Container Image | ||
runs-on: ubuntu-latest | ||
needs: | ||
- release | ||
permissions: | ||
- packages: write | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v4 | ||
- name: Get SpringBoot-Jar | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: bootjar | ||
path: monitor/build/libs/ | ||
- name: Build Monitor Image | ||
working-directory: ./monitor | ||
env: | ||
RELEASE: ${{ needs.release.outputs.release_tag }} | ||
run: | | ||
docker build --file Dockerfile --tag ghcr.io/$GITHUB_REPOSITORY:$RELEASE --tag ghcr.io/$GITHUB_REPOSITORY:latest . | ||
- name: Login to Github Container Registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Push Image to Github Container Registry | ||
run: | | ||
docker push --all-tags ghcr.io/$GITHUB_REPOSITORY |