Updates #42
Workflow file for this run
This file contains hidden or 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
# Workflow triggering | |
on: | |
push: | |
branches: | |
- master | |
tags: | |
- 'v*' | |
name: OpCon CLI | |
jobs: | |
########### | |
# PACKAGE # | |
########### | |
Job_Package: | |
runs-on: ubuntu-latest | |
name: Package | |
steps: | |
# Checkout the code | |
- name: Code checkout | |
uses: actions/checkout@master | |
# Prepare the environment with Java 11 | |
- name: Setup java | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 11 | |
# Build the maven project, output into ./opcon-cli-dist/ | |
- name: Build | |
run: mvn clean package | |
#################################### | |
# Create Windows Distribution File # | |
#################################### | |
# Download the latest GA OpenJDK JRE 11 from AdoptOpenJDK for Windows x64 | |
- name: Get Java 11 JRE for Windows x64 | |
run: curl -L "https://api.adoptopenjdk.net/v3/binary/latest/11/ga/windows/x64/jre/hotspot/normal/adoptopenjdk" --output java.zip | |
# Extract Windows JRE | |
- name: Extract JRE into Java | |
run: 7z x java.zip -o./opcon-cli-dist/ | |
# Prepare the Windows distribution folder for Zip | |
- name: Create Windows Folder | |
run: | | |
mkdir OpConCLI_Windows | |
mv opcon-cli-dist/jdk-* OpConCLI_Windows/java | |
cp opcon-cli-dist/opconcli.exe OpConCLI_Windows/ | |
cp opcon-cli-dist/EncryptValue.exe OpConCLI_Windows/ | |
cp opcon-cli-dist/Connector.config OpConCLI_Windows/ | |
# Zip the folder that contains all binaries and configuration to run on Windows (including Java) | |
- name: Zip Windows Folder | |
uses: montudor/action-zip@v0.1.0 | |
with: | |
args: zip -qq -r ./OpConCLI_Windows.zip ./OpConCLI_Windows | |
# Upload the OpConCLI_Windows.zip file as artifact | |
- uses: actions/upload-artifact@v1 | |
with: | |
name: OpConCLI_Windows.zip | |
path: ./OpConCLI_Windows.zip | |
################################## | |
# Create Linux Distribution File # | |
################################## | |
# Download the latest GA OpenJDK JRE 11 from AdoptOpenJDK for Linux x64 | |
- name: Get Java 11 JRE for Linux x64 | |
run: curl -L "https://api.adoptopenjdk.net/v3/binary/latest/11/ga/linux/x64/jre/hotspot/normal/adoptopenjdk" --output java.tar.gz | |
# Extract Linux JRE | |
- name: Extract JRE into Java | |
run: tar xvzf java.tar.gz -C ./opcon-cli-dist | |
# Prepare the Linux distribution folder for Zip | |
- name: Create Linux Folder | |
run: | | |
mkdir OpConCLI_Linux | |
mv opcon-cli-dist/jdk-* OpConCLI_Linux/java | |
chmod a+x opcon-cli-dist/opconcli | |
cp opcon-cli-dist/opconcli OpConCLI_Linux/ | |
chmod a+x opcon-cli-dist/EncryptValue | |
cp opcon-cli-dist/EncryptValue OpConCLI_Linux/ | |
cp opcon-cli-dist/Connector.config OpConCLI_Linux/ | |
cp opcon-cli-dist/opcon.command.api.jar OpConCLI_Linux/ | |
# tar.gz the folder that contains all binaries and configuration to run on Linux (including Java) | |
- name: Zip Linux Folder | |
run: tar -cvzf ./OpConCLI_Linux.tar.gz ./OpConCLI_Linux | |
# Upload the OpConCLI_Linux.tar.gz file as artifact | |
- uses: actions/upload-artifact@v1 | |
with: | |
name: OpConCLI_Linux.tar.gz | |
path: ./OpConCLI_Linux.tar.gz | |
######################### | |
# RELEASE | TAG CREATED # | |
######################### | |
Job_Release: | |
# Release - only ran when pushing new Tag starting with 'v' | |
if: startsWith(github.ref, 'refs/tags/v') | |
name: Release | |
needs: job_Package | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download Windows Package | |
uses: actions/download-artifact@v1 | |
with: | |
name: OpConCLI_Windows.zip | |
path: ./ | |
- name: Download Linux Package | |
uses: actions/download-artifact@v1 | |
with: | |
name: OpConCLI_Linux.tar.gz | |
path: ./ | |
# Create a new release out of the Tag being pushed | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@latest | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: Release ${{ github.ref }} | |
draft: false | |
prerelease: false | |
# Upload the Windows Zip distribution to the newly created Release | |
- name: Upload Windows Release Asset | |
id: upload_release_asset_win | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: OpConCLI_Windows.zip | |
asset_name: OpConCLI_Windows.zip | |
asset_content_type: application/zip | |
# Upload the Windows Zip distribution to the newly created Release | |
- name: Upload Linux Release Asset | |
id: upload_release_asset_linux | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: OpConCLI_Linux.tar.gz | |
asset_name: OpConCLI_Linux.tar.gz | |
asset_content_type: application/gzip |