Merge pull request #554 from microsoft/dev #71
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
on: | |
push: | |
branches: | |
- main | |
tags: | |
- v* | |
name: Build and create release | |
permissions: | |
actions: write | |
checks: write | |
contents: write | |
deployments: write | |
id-token: write | |
issues: write | |
discussions: write | |
packages: write | |
pages: write | |
pull-requests: write | |
repository-projects: write | |
security-events: write | |
statuses: write | |
jobs: | |
build: | |
name: Build and upload release binary | |
if: ${{ startsWith(github.ref, 'refs/tags/v')}} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up JDK 11 | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 11 | |
- name: Get java-version | |
id: get-version | |
run: | | |
BUILD_VERSION=$( mvn help:evaluate -Dexpression=project.version -q -DforceStdout ) | |
echo "::set-output name=VERSION::$BUILD_VERSION" | |
- name: Build with Maven | |
run: mvn -B package --file pom.xml | |
- name: Run Unit Tests | |
run: mvn clean test | |
- name: Run Integration Test | |
shell: pwsh | |
run: ./src/docker/startup.ps1 | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: Release ${{ github.ref }} | |
draft: false | |
prerelease: false | |
- name: Upload Release Asset 1 | |
id: upload-release-asset-1 | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./target/kafka-connect-cosmos-${{steps.get-version.outputs.VERSION}}-jar-with-dependencies.jar | |
asset_name: kafka-connect-cosmos-${{steps.get-version.outputs.VERSION}}-jar-with-dependencies.jar | |
asset_content_type: application/java-archive | |
- name: Upload Release Asset 2 | |
id: upload-release-asset-2 | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./target/components/packages/microsoftcorporation-kafka-connect-cosmos-${{steps.get-version.outputs.VERSION}}.zip | |
asset_name: microsoftcorporation-kafka-connect-cosmos-${{steps.get-version.outputs.VERSION}}.zip | |
asset_content_type: application/zip |