Skip to content

Release version 0.2.0 #35

Release version 0.2.0

Release version 0.2.0 #35

name: Build, release, and publish
on:
push:
tags:
- v**
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Current ref
run: echo "Current ref ${{ github.ref }}"
- name: Checkout
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: 17
distribution: temurin
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- name: Set up Python 3.10
uses: actions/setup-python@v5
with:
python-version: "3.10"
cache: pip
- name: Display Python version
run: python -c "import sys; print(sys.version)"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install hatch
- name: Build uber jar with Gradle
run: ./gradlew shadowJar
- name: Store the uber jar as asset
uses: actions/upload-artifact@v4
with:
name: uber-jar
path: java/build/libs/jp2rt-*-all.jar
- name: Build Python package with Hatch
run: hatch build
- name: Store the distribution packages
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Setup GitHub Pages
uses: actions/configure-pages@v4
- name: Build docs with Hatch
run: hatch run docs:build
- name: Store the generated documentation
uses: actions/upload-pages-artifact@v3
with:
path: docs/_build/html/
release:
runs-on: ubuntu-latest
needs: build
permissions:
contents: write
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Download uber jar
uses: actions/download-artifact@v4
with:
name: uber-jar
path: .
- name: Download generated docs
uses: actions/download-artifact@v4
with:
name: github-pages
path: .
- name: Convert to zip the docs
run: |
mkdir docs-${GITHUB_REF##*/}
tar -C docs-${GITHUB_REF##*/} -xvf artifact.tar
zip -r docs-${GITHUB_REF##*/}.zip docs-${GITHUB_REF##*/}
- name: Release
uses: softprops/action-gh-release@v2
with:
body_path: CHANGELOG.md
files: |
jp2rt-*-all.jar
docs-*.zip
pages:
runs-on: ubuntu-latest
needs: build
permissions:
id-token: write
pages: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
pypi:
runs-on: ubuntu-latest
needs: build
permissions:
id-token: write
environment:
name: pypi
url: https://pypi.org/p/jp2rt
steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
packages:
runs-on: ubuntu-latest
needs: build
permissions:
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: 17
distribution: temurin
cache: gradle
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
settings-path: ${{ github.workspace }} # location for the settings.xml file
- name: Setup Gradle
uses: gradle/actions/setup-gradle@v3
- name: Publish to GitHub Packages
run: ./gradlew publish
env:
GITHUB_ACTOR: mapio
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}