Skip to content

apim-accelerator-release-build #3

apim-accelerator-release-build

apim-accelerator-release-build #3

name: apim-accelerator-release-build
on:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
# Extract the version from the pom.xml file
- name: Extract version from pom.xml
id: extract_version
run: |
VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
echo "Project version: $VERSION"
echo "::set-output name=version::$VERSION"
- name: Build with Maven
run: mvn clean install
- name: Locate ZIP file
id: locate_zip
run: echo "::set-output name=zipfile::$(find ./distribution/apim-accelerator/target -name '*.zip' | head -n 1)"
# Print the ZIP file path as a debug step
- name: Print ZIP file path
run: echo "ZIP file created at ${{ steps.locate_zip.outputs.zipfile }}"
- name: Create Tag
id: create_tag
run: |
TAG="v${{ steps.extract_version.outputs.version }}"
git tag $TAG
git push origin $TAG
echo "::set-output name=tag::$TAG"
# Create a Pre-Release
- name: Create Pre-Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.create_tag.outputs.tag }}
release_name: "Healthcare APIM Accelerator - ${{ steps.create_tag.outputs.tag }}"
draft: false
prerelease: true
# Upload Accelerator ZIP to Pre-Release
- name: Upload ZIP to Pre-Release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ${{ steps.locate_zip.outputs.zipfile }}
asset_name: "wso2-hcam-accelerator-${{ steps.extract_version.outputs.version }}.zip"
asset_content_type: application/zip