Skip to content

Start implementing unified CI/CD workflow #1

Start implementing unified CI/CD workflow

Start implementing unified CI/CD workflow #1

Workflow file for this run

name: Run CI/CD pipeline
on:
push:
branches: "*"
tags: "v[0-9]+.[0-9]+.[0-9]+*"
workflow_dispatch:
inputs:
release:
description: Release this version
type: boolean
default: false
env:
PYPI_PACKAGE: hexdoc-hexdebug
permissions:
contents: read
jobs:
build-mod:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
- uses: gradle/actions/setup-gradle@v3
- name: Build mod
run: ./gradlew build
- name: Check if datagen needs to be run
timeout-minutes: 5
run: |
./gradlew runAllDatagen
git add --intent-to-add .
git diff --name-only --exit-code -- ":!:*/src/generated/resources/.cache/*"
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: mod-build
path: "**/build/libs/*.jar"
if-no-files-found: error
build-docs:
uses: hexdoc-dev/hexdoc/.github/workflows/hexdoc.yml@v1!0.1.dev
permissions:
contents: write
pages: read
secrets:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
python-version: 3.11
deploy-pages: ${{ (github.head_ref || github.ref_name) == 'refs/heads/main' }}
release: |-
${{
github.event_name != 'push' && inputs.release
|| github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
}}
publish-mod:
runs-on: ubuntu-latest
needs: [build-mod, build-docs]
if: needs.build-docs.outputs.release == 'true'
environment:
name: curseforge-modrinth
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with:
name: mod-build
path: dist
# TODO: implement
publish-docs:
runs-on: ubuntu-latest
needs: [build-mod, build-docs]
if: needs.build-docs.outputs.release == 'true'
environment:
name: pypi
url: https://pypi.org/p/${{ env.PYPI_PACKAGE }}
permissions:
id-token: write
steps:
# hexdoc workflow uses v3, so we can't use v4 here
- uses: actions/download-artifact@v3
with:
name: hexdoc-build
path: dist
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1