Release SDKs #30
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: Release SDKs | |
env: | |
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} | |
PYPI_USERNAME: ${{ secrets.PYPI_USERNAME }} | |
PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | |
MAVEN_GPG_PRIVATE_KEY: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} | |
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} | |
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} | |
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }} | |
PYTHON_SDK_LOCATION: "python/src" | |
JAVA_SDK_LOCATION: "java" | |
DOTNET_SDK_LOCATION: "dotnet/StachExtensions/FactSet.Protobuf.Stach.Extensions" | |
on: | |
workflow_dispatch: | |
inputs: | |
SDKs: | |
description: 'Which SDK to release? Options are "all", "java", "python" and "dotnet"' | |
required: true | |
default: all | |
jobs: | |
dotnet: | |
runs-on: ubuntu-latest | |
if: github.event_name == 'release' || (github.event_name == 'workflow_dispatch' | |
&& (github.event.inputs.SDKs == 'dotnet' || github.event.inputs.SDKs == 'all')) | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup Nuget | |
uses: nuget/setup-nuget@v1 | |
with: | |
nuget-api-key: ${{ env.NUGET_API_KEY }} | |
nuget-version: '5.x' | |
- name: Setup .NET Core | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: 3.1 | |
- name: Build and create the package | |
run: dotnet build --configuration Release ${{ env.DOTNET_SDK_LOCATION }}/FactSet.Protobuf.Stach.Extensions.csproj | |
- name: Publish the package to Nuget | |
run: | | |
nuget push ${{ env.DOTNET_SDK_LOCATION }}/bin/Release/*.nupkg -Source https://api.nuget.org/v3/index.json | |
python: | |
runs-on: ubuntu-latest | |
if: (github.event_name == 'workflow_dispatch' | |
&& (github.event.inputs.SDKs == 'python' || github.event.inputs.SDKs == 'all')) | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python 3.7 | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.7 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install setuptools wheel twine | |
- name: Build and publish to PyPI | |
env: | |
TWINE_USERNAME: ${{ env.PYPI_USERNAME }} | |
TWINE_PASSWORD: ${{ env.PYPI_PASSWORD }} | |
run: | | |
cd ${{ env.PYTHON_SDK_LOCATION }} | |
python setup.py sdist bdist_wheel | |
twine upload dist/* --verbose | |
java: | |
runs-on: ubuntu-latest | |
if: (github.event_name == 'workflow_dispatch' | |
&& (github.event.inputs.SDKs == 'java' || github.event.inputs.SDKs == 'all')) | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Java JDK | |
uses: actions/setup-java@v1 | |
with: | |
java-version: 1.8 | |
server-id: ossrh | |
server-username: MAVEN_USERNAME | |
server-password: MAVEN_PASSWORD | |
gpg-private-key: ${{ env.MAVEN_GPG_PRIVATE_KEY }} | |
gpg-passphrase: MAVEN_GPG_PASSPHRASE | |
- name: Build | |
run: | | |
mvn -B package --file ${{ env.JAVA_SDK_LOCATION }}/pom.xml | |
- name: Publish to Apache Maven Central | |
run: | | |
cd ${{ env.JAVA_SDK_LOCATION }} | |
mvn -Psign-artifacts verify deploy |