Skip to content

Release Integrations without JEC scripts #4

Release Integrations without JEC scripts

Release Integrations without JEC scripts #4

name: Release Integrations without JEC scripts
on:
workflow_dispatch:
inputs:
integration:
description: 'Integration Type'
required: true
type: choice
options:
- opsview
- vcenter
- vcsa
- oem
jobs:
setup:
name: Setup For ${{ github.event.inputs.integration }} Release
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
integration_name: ${{ steps.gather_params.outputs.INTEGRATION_NAME }}
integration_version: ${{ steps.gather_params.outputs.INTEGRATION_VERSION }}
steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v2
- name: Retrieve Integration Version
id: gather_params
run: |
echo ::set-output name=INTEGRATION_VERSION::$(jq -r --arg v "${{ github.event.inputs.integration }}" '.[$v]' release/integration-builder/version.json)
echo ::set-output name=INTEGRATION_NAME::$(echo "${{ github.event.inputs.integration }}" | awk '{print tolower($0)}')
- name: Create ${{ github.event.inputs.integration }} Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
INTEGRATION_VERSION: ${{ steps.gather_params.outputs.INTEGRATION_VERSION }}
INTEGRATION_NAME: ${{ github.event.inputs.integration }}
with:
tag_name: jsm-${{ env.INTEGRATION_NAME }}-${{ env.INTEGRATION_VERSION }}
release_name: jsm-${{ env.INTEGRATION_NAME }}-${{ env.INTEGRATION_VERSION }}
draft: true
build-gradle-project:
name: Build gradle project
runs-on: ubuntu-latest
needs: [setup]
env:
INTEGRATION_NAME: ${{ needs.setup.outputs.integration_name }}
INTEGRATION_VERSION: ${{ needs.setup.outputs.integration_version }}
if: github.ref == 'refs/heads/master'
steps:
- name: Checkout project sources
uses: actions/checkout@v2
- name: Set up JDK 8
uses: actions/setup-java@v2
with:
java-version: 8
distribution: 'temurin'
- name: Set up Go 1.x
uses: actions/setup-go@v2
with:
go-version: 1.15.7
id: go
- name: Create Go Build Output Directory
run: mkdir -p ./go-build/${{ env.INTEGRATION_NAME }}
- name: Copy Integration Files
run: cp -R ${{ github.event.inputs.integration }}/. ./go-build/${{ env.INTEGRATION_NAME }}
- name: "Build Linux Go scripts"
if: ${{env.INTEGRATION_NAME != 'vcenter'}}
run: |
go get -u github.com/alexcesaro/log && \
cd ./go-build/${{ env.INTEGRATION_NAME }}/scripts && \
GOOS=linux GOARCH=amd64 go build -o send2jsm send2jsm.go
- name: "Build Windows Go scripts"
if: ${{env.INTEGRATION_NAME == 'vcenter'}}
run: |
go get -u github.com/alexcesaro/log && \
cd ./go-build/${{ env.INTEGRATION_NAME }}/scripts && \
GOOS=windows GOARCH=386 go build -o send2jsm.exe send2jsm.go
- name: Upload Go Build Files
uses: actions/upload-artifact@v2
with:
name: Build Go Artifact
path: ./go-build/${{ env.INTEGRATION_NAME }}/*
- name: Copy Gradle Files
run: cp -R release/integration-builder/. ./
- name: Copy Integration Files with Builds
run: cp -R ./go-build/${{ env.INTEGRATION_NAME }}/* ./${{ env.INTEGRATION_NAME }}/
- name: Remove old builds
run: rm -rf build
- name: Build with Gradle
run:
./gradlew ${{ env.INTEGRATION_NAME }}
- name: Upload Build Files
uses: actions/upload-artifact@v2
with:
name: Build Files Artifact
path: build/*
- name: Upload Red Hat 6 Based Artifact
if: ${{env.INTEGRATION_NAME != 'vcenter'}}
uses: actions/upload-artifact@v2
with:
name: RHEL6 Artifact
path: build/distributions/jsm-${{ env.INTEGRATION_NAME }}-${{ env.INTEGRATION_VERSION }}-1.all.noarch.rpm
- name: Release RHEL6 package
if: ${{env.INTEGRATION_NAME != 'vcenter'}}
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.setup.outputs.upload_url }}
asset_path: build/distributions/jsm-${{ env.INTEGRATION_NAME }}-${{ env.INTEGRATION_VERSION }}-1.all.noarch.rpm
asset_name: jsm-${{ env.INTEGRATION_NAME }}-${{ env.INTEGRATION_VERSION }}-1.all.noarch.rpm
asset_content_type: application/octet-stream
- name: Upload Debian Based Artifact
if: ${{env.INTEGRATION_NAME != 'vcsa' && env.INTEGRATION_NAME != 'vcenter'}}
uses: actions/upload-artifact@v2
with:
name: Debian Artifact
path: build/distributions/jsm-${{ env.INTEGRATION_NAME }}_${{ env.INTEGRATION_VERSION }}_all.deb
- name: Release Debian package
if: ${{env.INTEGRATION_NAME != 'vcsa' && env.INTEGRATION_NAME != 'vcenter'}}
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.setup.outputs.upload_url }}
asset_path: build/distributions/jsm-${{ env.INTEGRATION_NAME }}_${{ env.INTEGRATION_VERSION }}_all.deb
asset_name: jsm-${{ env.INTEGRATION_NAME }}_${{ env.INTEGRATION_VERSION }}_all.deb
asset_content_type: application/octet-stream
- name: Upload Win64 Based Artifact
if: ${{env.INTEGRATION_NAME == 'vcenter'}}
uses: actions/upload-artifact@v2
with:
name: Win64 Artifact
path: build/distributions/jsm-${{ env.INTEGRATION_NAME }}-${{ env.INTEGRATION_VERSION }}.zip
- name: Release Win64 Package
if: ${{env.INTEGRATION_NAME == 'vcenter'}}
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.setup.outputs.upload_url }}
asset_path: build/distributions/jsm-${{ env.INTEGRATION_NAME }}-${{ env.INTEGRATION_VERSION }}.zip
asset_name: jsm-${{ env.INTEGRATION_NAME }}-${{ env.INTEGRATION_VERSION }}.zip
asset_content_type: application/zip