Skip to content

Merge pull request #35 from juhoautio-rovio/release_1.0.4 #31

Merge pull request #35 from juhoautio-rovio/release_1.0.4

Merge pull request #35 from juhoautio-rovio/release_1.0.4 #31

Workflow file for this run

# Based on
# https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#publishing-using-apache-maven
name: deploy
on:
push:
branches:
- main
# poetry-dynamic-versioning gets the version from release tag.
# that's why the same steps work for pushes to main & releases.
release:
# without this a new release tag triggers 3 builds instead of 1
# https://github.community/t/action-run-being-trigger-multiple-times/16144
types: [published]
jobs:
test-and-deploy:
runs-on: ubuntu-latest
steps:
- name: Set Environment variables
run: echo "SPARK_LOCAL_IP=localhost" >> $GITHUB_ENV
- uses: actions/checkout@v2
with:
# poetry-dynamic-versioning needs the full history. latest commit is not enough.
fetch-depth: '0'
- name: Set up JDK 8
uses: actions/setup-java@v2
with:
distribution: 'adopt'
java-version: '8'
- name: Run maven tests & package
run: mvn -B package --file pom.xml
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: '3.7'
- name: Install Poetry
run: pip install --upgrade MarkupSafe==2.0.1 poetry-core==1.0.4 poetry==1.1.8 poetry-dynamic-versioning==0.12.7
- name: Install libkrb5-dev
run: sudo apt-get install libkrb5-dev # This is needed for installing pykerberos
- name: Install python dependencies
run: poetry install
working-directory: ./python
- name: Run python tests
run: poetry run pytest
working-directory: ./python
- name: Build python package
run: poetry build
working-directory: ./python
- name: Publish to PyPI
run: poetry publish -u '__token__' -p '${{ secrets.PYPI_TOKEN }}'
working-directory: ./python
- name: Set up Apache Maven Central
uses: actions/setup-java@v2
with: # running setup-java again overwrites the settings.xml
distribution: 'adopt'
java-version: '8'
server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml
server-username: MAVEN_USERNAME # env variable for username in deploy
server-password: MAVEN_CENTRAL_TOKEN # env variable for token in deploy
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Value of the GPG private key to import
gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase
- name: Publish to Apache Maven Central
run: mvn deploy -DskipTests
env:
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}