-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
83 additions
and
10 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,42 +3,80 @@ name: Release | |
on: | ||
release: | ||
types: [published] | ||
# Can be called manually | ||
workflow_dispatch: | ||
inputs: | ||
release_tag: | ||
description: 'Release tag' | ||
default: 'latest' | ||
type: string | ||
checkout_ref: | ||
description: 'Ref to checkout for doc index (default to current branch)' | ||
default: '' | ||
type: string | ||
|
||
env: | ||
DOCUMENTATION_CNAME: 'post.docs.pyansys.com' | ||
MEILISEARCH_API_KEY: ${{ secrets.MEILISEARCH_API_KEY }} | ||
MEILISEARCH_PUBLIC_API_KEY: ${{ secrets.MEILISEARCH_PUBLIC_API_KEY }} | ||
|
||
jobs: | ||
|
||
get_latest_tag: | ||
name: "Get latest release version tag" | ||
runs-on: ubuntu-latest | ||
outputs: | ||
version: ${{ steps.step1.outputs.version }} | ||
steps: | ||
- id: step1 | ||
name: "Get version tag" | ||
shell: bash | ||
run: | | ||
get_latest_release() { | ||
curl --silent "https://api.github.com/repos/$1/releases/latest" | | ||
grep '"tag_name":' | | ||
sed -E 's/.*"([^"]+)".*/\1/' | ||
} | ||
version=$(get_latest_release "ansys/pydpf-post") | ||
echo $version | ||
echo "version=$version" >> "$GITHUB_OUTPUT" | ||
Publish_to_PyPI: | ||
name: Publish to PyPI | ||
name: "Publish Release to PyPI" | ||
runs-on: ubuntu-latest | ||
if: startsWith(github.ref, 'refs/tags/v') | ||
needs: get_latest_tag | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: "Download Release Assets" | ||
uses: robinraju/[email protected] | ||
with: | ||
tag: ${{ github.event.inputs.release_tag || needs.get_latest_tag.outputs.version }} | ||
fileName: "*.whl" | ||
tarBall: false | ||
zipBall: false | ||
out-file-path: "assets" | ||
extract: false | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: "Upload to Public PyPI" | ||
run: | | ||
pip install twine | ||
pip install build | ||
python -m build | ||
twine upload --skip-existing dist/* | ||
twine upload --skip-existing assets/* | ||
env: | ||
TWINE_USERNAME: __token__ | ||
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} | ||
|
||
|
||
upload_docs_release: | ||
name: "Upload release documentation" | ||
if: startsWith(github.ref, 'refs/tags/v') | ||
runs-on: ubuntu-latest | ||
needs: [Publish_to_PyPI] | ||
runs-on: ubuntu-latest | ||
steps: | ||
|
||
- name: "Download Release Asset - HTML" | ||
uses: dsaltares/[email protected] | ||
with: | ||
file: HTML-doc-ansys-dpf-post.zip | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
version: ${{ github.event.inputs.release_tag && format('tags/{0}', github.event.inputs.release_tag) || format('tags/{0}', needs.get_latest_tag.outputs.version) }} | ||
|
||
- name: "List downloaded assets" | ||
shell: bash | ||
|
@@ -59,8 +97,43 @@ jobs: | |
doc-artifact-name: HTML-doc-ansys-dpf-post.zip | ||
decompress-artifact: true | ||
|
||
doc-index-stable: | ||
name: "Deploy stable docs index" | ||
runs-on: ubuntu-latest | ||
needs: upload_docs_release | ||
steps: | ||
- name: "Install Git and clone project" | ||
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.event.inputs.checkout_ref || '' }} | ||
|
||
- name: "Install the package requirements" | ||
run: | | ||
python3 -m venv .venv | ||
.venv/bin/python -m pip install -e . | ||
- name: "Get the version to PyMeilisearch" | ||
run: | | ||
VERSION=$(.venv/bin/python -c "from ansys.dpf.post import __version__; print('.'.join(__version__.split('.')[:2]))") | ||
VERSION_MEILI=$(.venv/bin/python -c "from ansys.dpf.post import __version__; print('-'.join(__version__.split('.')[:2]))") | ||
echo "Calculated VERSION: $VERSION" | ||
echo "Calculated VERSION_MEILI: $VERSION_MEILI" | ||
echo "VERSION=$VERSION" >> $GITHUB_ENV | ||
echo "VERSION_MEILI=$VERSION_MEILI" >> $GITHUB_ENV | ||
- name: "Deploy the latest documentation index" | ||
uses: ansys/actions/doc-deploy-index@v5 | ||
with: | ||
cname: ${{ env.DOCUMENTATION_CNAME }}/version/${{ env.VERSION }} | ||
index-name: pydpf-post-v${{ env.VERSION_MEILI }} | ||
host-url: ${{ vars.MEILISEARCH_HOST_URL }} | ||
api-key: ${{ env.MEILISEARCH_API_KEY }} | ||
doc-artifact-name: HTML-doc-ansys-dpf-post.zip | ||
decompress-artifact: true | ||
|
||
update_ansys_lab_examples: | ||
uses: ./.github/workflows/ansys_lab.yml | ||
needs: get_latest_tag | ||
with: | ||
version: latest | ||
version: ${{ github.event.inputs.release_tag || needs.get_latest_tag.outputs.version }} | ||
secrets: inherit |