Skip to content

Release Script - APIUtils - refs/tags/v1.3.1 #6

Release Script - APIUtils - refs/tags/v1.3.1

Release Script - APIUtils - refs/tags/v1.3.1 #6

# Workflow to build and release a new version of the APIUtils onto pypi.
name: Release Script - APIUtils
run-name: ${{ format('{0} - {1}', github.workflow, github.event_name == 'release' && github.ref || 'Manual Run') }}
on:
workflow_dispatch:
release:
types: [prereleased, released]
jobs:
build:
name: Build Python Package
uses: ./.github/workflows/BUILD_APIUtils.yml
with:
with_caching: true
testbed_server_config:
name: ServerConfig Testbed
needs: build
uses: ./.github/workflows/TEST_ServerConfig.yml
testbed_hello:
name: HelloAPI Testbed
needs: build
uses: ./.github/workflows/TEST_HelloAPI_local.yml
testbed_api_response:
name: APIResponse Testbed
needs: build
uses: ./.github/workflows/TEST_APIResponse.yml
testbed_api_utils:
name: APIUtils Testbed
needs: build
uses: ./.github/workflows/TEST_APIUtils.yml
release:
name: Publish Release to PyPI
needs: [build, testbed_server_config, testbed_hello, testbed_api_response, testbed_api_utils]
if: github.event.action == 'released'
runs-on: ubuntu-22.04
environment:
name: pypi_release
url: https://pypi.org/manage/project/opengamedata-api-utils/
permissions:
id-token: write
steps:
# 1. Local checkout & config
- name: Restore Cached Build
id: cached-build
uses: actions/cache/restore@v4
with:
key: opengamedata-api-utils-build-${{ github.run_id }}-${{ github.run_attempt }}
path: ./dist/
fail-on-cache-miss: true
- name: Fail if Cache Restore Failed
if: steps.cached-build.outputs.cache-hit == 'false'
run: exit 1
# 2. Build
# 3. Remote config & deploy
- name: Publish to PyPI
if: steps.cached-build.outputs.cache-hit == 'true'
uses: pypa/gh-action-pypi-publish@release/v1
with:
print-hash: true
# 4. Cleanup & complete
prerelease:
name: Publish Prerelease to PyPI
needs: [build, testbed_server_config, testbed_hello, testbed_api_response, testbed_api_utils]
if: github.event.action == 'prereleased'
runs-on: ubuntu-22.04
environment:
name: pypi_prerelease
url: https://pypi.org/manage/project/opengamedata-api-utils/
permissions:
id-token: write
steps:
# 1. Local checkout & config
- name: Restore Cached Build
id: cached-build
uses: actions/cache/restore@v4
with:
key: opengamedata-api-utils-build-${{ github.run_id }}-${{ github.run_attempt }}
path: ./dist/
fail-on-cache-miss: true
- name: Fail if Cache Restore Failed
if: steps.cached-build.outputs.cache-hit == 'false'
run: exit 1
# 2. Build
# 3. Remote config & deploy
- name: Publish to PyPI
if: steps.cached-build.outputs.cache-hit == 'true'
uses: pypa/gh-action-pypi-publish@release/v1
with:
print-hash: true
repository-url: https://test.pypi.org/legacy/
# 4. Cleanup & complete