Stop a minor fight over syntax of (Github) workflows #302
Workflow file for this run
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
name: release | |
concurrency: release | |
env: | |
PYTHON_VERSION_BUMP: "3.12" | |
PYTHON_VERSION_BUILD_EXES: "3.12" | |
PYTHON_VERSION_RELEASE: "3.12" | |
PYTHON_VERSION_BUILD_DOCS: "3.12" | |
PYTHON_VERSION_UPDATE_WEB: "3.12" | |
POETRY_VERSION: "1.4" | |
on: | |
pull_request_target: | |
branches: [main, develop] | |
types: [closed] | |
jobs: | |
bump-version: | |
if: | |
| # skip if: trying to re-run; PR is closed without merging; '[skip release]' is in the PR title; or if merging any branch other than pre_release_branch into release_branch | |
( | |
github.run_attempt == '1' | |
&& github.event.pull_request.merged | |
&& ! contains(github.event.pull_request.title, '[skip release]') | |
&& ( | |
github.event.pull_request.base.ref == 'develop' || ( | |
github.event.pull_request.base.ref == 'main' | |
&& github.event.pull_request.head.ref == 'develop' | |
) | |
) | |
) | |
runs-on: ubuntu-latest | |
outputs: | |
new_tag_name: ${{ steps.get_new_tag.outputs.new_tag_name }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # get all history and tags | |
ref: ${{ github.event.pull_request.base.ref }} | |
token: ${{ secrets.HPCFLOW_ACTIONS_TOKEN }} | |
- run: | | |
git config user.name hpcflow-actions | |
git config user.email hpcflow-actions@users.noreply.github.com | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.PYTHON_VERSION_BUMP }} | |
- name: Get git-chglog executable | |
run: | | |
wget https://github.com/git-chglog/git-chglog/releases/download/v0.15.0/git-chglog_0.15.0_linux_amd64.tar.gz | |
tar --extract --file git-chglog_0.15.0_linux_amd64.tar.gz git-chglog | |
- name: Install commitizen | |
run: pip install commitizen | |
- name: Manipulate tags (stable release) | |
if: github.event.pull_request.base.ref == 'main' | |
run: | |
| # delete all pre-release tags, set current version to the latest stable release, | |
CUR_PRE_TAG=$(git describe --tags $(git rev-list --tags --max-count=1)) | |
echo "CUR_PRE_TAG is: $CUR_PRE_TAG" | |
echo "cur_pre_tag=$CUR_PRE_TAG" >> $GITHUB_ENV | |
git tag -l | awk '/^(v[0-9]+\.[0-9]+\.[0-9]+(a|b|rc).*)$/ {print $1}' | xargs git tag -d | |
- name: Get current tag | |
run: | | |
CUR_TAG=$(git describe --tags $(git rev-list --tags --max-count=1)) | |
echo "CUR_TAG is: $CUR_TAG" | |
echo "cur_tag=$CUR_TAG" >> $GITHUB_ENV | |
- name: Commitizen bump (pre-release) # Bump version strings (pre-release) and add a new tag; commit | |
if: github.event.pull_request.base.ref == 'develop' | |
run: cz bump --prerelease alpha | |
- name: Commitizen bump # First update version number to latest stable release, then bump to new stable release, add a new tag and commit | |
if: github.event.pull_request.base.ref == 'main' | |
run: | | |
python3 -c " | |
from commitizen.bump import update_version_in_files | |
update_version_in_files( | |
current_version='${{ env.cur_pre_tag }}'.lstrip('v'), | |
new_version='${{ env.cur_tag }}'.lstrip('v'), | |
files=['pyproject.toml', 'hpcflow/_version.py'], | |
)" | |
cz bump | |
- name: Get new tag | |
id: get_new_tag | |
run: | | |
NEW_TAG=$(git describe --tags $(git rev-list --tags --max-count=1)) | |
echo "NEW_TAG is: $NEW_TAG" | |
echo "new_tag=$NEW_TAG" >> $GITHUB_ENV | |
echo "new_tag_name=$NEW_TAG" >> $GITHUB_OUTPUT | |
- name: Generate CHANGELOG (stable release) | |
if: github.event.pull_request.base.ref == 'main' | |
run: | | |
./git-chglog --output CHANGELOG.md | |
git add CHANGELOG.md | |
- name: Generate CHANGELOG-dev (pre-release) | |
if: github.event.pull_request.base.ref == 'develop' | |
run: | | |
./git-chglog --output CHANGELOG-dev.md | |
git add CHANGELOG-dev.md | |
- name: Push new CHANGELOG | |
run: | | |
git tag -d ${{ env.new_tag }} | |
git commit --amend --no-edit | |
git tag ${{ env.new_tag }} | |
git push && git push origin ${{ env.new_tag }} | |
- name: Rebase into develop branch if exists (stable release) | |
if: github.event.pull_request.base.ref == 'main' | |
run: | | |
exists_in_remote=$(git ls-remote --heads origin refs/heads/develop) | |
echo "exists_in_remote: $exists_in_remote" | |
if [[ -n $exists_in_remote ]]; then | |
export SKIP=end-of-file-fixer | |
git checkout develop | |
git pull | |
git rebase main | |
git push -u origin develop | |
else | |
echo "No develop branch to merge into." | |
fi | |
- name: Generate incremental CHANGELOG for GitHub release body (stable release) | |
if: github.event.pull_request.base.ref == 'main' | |
run: | | |
./git-chglog --template .chglog/RELEASE.tpl.md --output CHANGELOG_increment.md ${{ env.cur_tag }}.. | |
cat CHANGELOG_increment.md | |
- name: Generate incremental CHANGELOG for GitHub release body (pre-release) | |
if: github.event.pull_request.base.ref == 'develop' | |
run: | | |
./git-chglog --template .chglog/RELEASE.tpl.md --output CHANGELOG_increment.md ${{ env.new_tag }} | |
cat CHANGELOG_increment.md | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: CHANGELOG_increment | |
path: CHANGELOG_increment.md | |
build-executables: | |
needs: bump-version | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [windows-2019, macos-13] | |
include: | |
- os: windows-2019 | |
executable_ext: .exe | |
executable_os: win | |
- os: macos-13 | |
executable_ext: "" | |
executable_os: macOS | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.base.ref }} # otherwise we get the ref when the workflow started (missing above commit) | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.PYTHON_VERSION_BUILD_EXES }} | |
- name: Cache the virtualenv | |
uses: actions/cache@v4 | |
with: | |
path: ./.venv | |
key: venv-build-${{ matrix.os }}-${{ hashFiles('**/poetry.lock') }} | |
- name: Install poetry | |
run: python -m pip install poetry==${{ env.POETRY_VERSION }} | |
- name: Configure poetry | |
run: | | |
poetry config virtualenvs.in-project true | |
poetry config installer.modern-installation false | |
- name: Install dependencies | |
run: poetry install --without dev | |
- name: Build with pyinstaller (non-Windows, file) | |
if: ${{ !contains(matrix.os, 'windows') }} | |
working-directory: pyinstaller | |
run: ./make.sh hpcflow-${{ needs.bump-version.outputs.new_tag_name }}-${{ matrix.executable_os }} INFO 'onefile' | |
- name: Build with pyinstaller (non-Windows, folder) | |
if: ${{ !contains(matrix.os, 'windows') }} | |
working-directory: pyinstaller | |
run: ./make.sh hpcflow-${{ needs.bump-version.outputs.new_tag_name}}-${{ matrix.executable_os }}-dir INFO 'onedir' | |
- name: Build with pyinstaller (Windows, file) | |
if: contains(matrix.os, 'windows') | |
working-directory: pyinstaller | |
run: ./make.ps1 -ExeName 'hpcflow-${{ needs.bump-version.outputs.new_tag_name }}-${{ matrix.executable_os }}' -LogLevel INFO -BuildType 'onefile' | |
- name: Build with pyinstaller (Windows, folder) | |
if: contains(matrix.os, 'windows') | |
working-directory: pyinstaller | |
run: ./make.ps1 -ExeName 'hpcflow-${{ needs.bump-version.outputs.new_tag_name }}-${{ matrix.executable_os }}-dir' -LogLevel INFO -BuildType 'onedir' | |
- name: Version check (windows, file) | |
if: contains(matrix.os, 'windows') | |
run: | | |
$tag = "${{ needs.bump-version.outputs.new_tag_name }}" | |
$tagNoV = $tag.trim('v') | |
$hpcflow_vers = pyinstaller/dist/onefile/hpcflow-${{ needs.bump-version.outputs.new_tag_name }}-${{ matrix.executable_os }}${{ matrix.executable_ext }} --version | |
$hpcflow_vers_expected = "hpcFlow, version $tagNoV" | |
echo $hpcflow_vers | |
echo "$hpcflow_vers_expected" | |
if ($hpcflow_vers -ne $hpcflow_vers_expected) { | |
exit 1 | |
} | |
- name: Version check (windows, folder) | |
if: contains(matrix.os, 'windows') | |
run: | | |
$tag = "${{ needs.bump-version.outputs.new_tag_name }}" | |
$tagNoV = $tag.trim('v') | |
$hpcflow_vers = pyinstaller/dist/onedir/hpcflow-${{ needs.bump-version.outputs.new_tag_name }}-${{ matrix.executable_os }}-dir/hpcflow-${{ needs.bump-version.outputs.new_tag_name }}-${{ matrix.executable_os }}-dir${{ matrix.executable_ext }} --version | |
$hpcflow_vers_expected = "hpcFlow, version $tagNoV" | |
echo $hpcflow_vers | |
echo "$hpcflow_vers_expected" | |
if ($hpcflow_vers -ne $hpcflow_vers_expected) { | |
exit 1 | |
} | |
- name: Version check (non-windows, file) | |
if: ${{ !contains(matrix.os, 'windows') }} | |
run: | | |
tag=${{ needs.bump-version.outputs.new_tag_name }} | |
tagNoV=${tag:1} | |
hpcflow_vers=$(pyinstaller/dist/onefile/hpcflow-${{ needs.bump-version.outputs.new_tag_name }}-${{ matrix.executable_os }}${{ matrix.executable_ext }} --version) | |
hpcflow_vers_expected="hpcFlow, version $tagNoV" | |
echo $hpcflow_vers | |
echo $hpcflow_vers_expected | |
[ "$hpcflow_vers" = "$hpcflow_vers_expected" ] | |
- name: Version check (non-windows, folder) | |
if: ${{ !contains(matrix.os, 'windows') }} | |
run: | | |
tag=${{ needs.bump-version.outputs.new_tag_name }} | |
tagNoV=${tag:1} | |
hpcflow_vers=$(pyinstaller/dist/onedir/hpcflow-${{ needs.bump-version.outputs.new_tag_name }}-${{ matrix.executable_os }}-dir/hpcflow-${{ needs.bump-version.outputs.new_tag_name }}-${{ matrix.executable_os }}-dir${{ matrix.executable_ext }} --version) | |
hpcflow_vers_expected="hpcFlow, version $tagNoV" | |
echo $hpcflow_vers | |
echo $hpcflow_vers_expected | |
[ "$hpcflow_vers" = "$hpcflow_vers_expected" ] | |
- name: Run test suite on the frozen app (folder) | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
pyinstaller/dist/onedir/hpcflow-${{ needs.bump-version.outputs.new_tag_name }}-${{ matrix.executable_os }}-dir/hpcflow-${{ needs.bump-version.outputs.new_tag_name }}-${{ matrix.executable_os }}-dir${{ matrix.executable_ext }} test | |
- name: Compress folder (windows, folder) | |
if: contains(matrix.os, 'windows') | |
working-directory: pyinstaller | |
run: ./compress.ps1 -ExeName 'hpcflow-${{ needs.bump-version.outputs.new_tag_name }}-${{ matrix.executable_os }}-dir' -BuildType 'onedir' | |
- name: Compress folder (non-windows, folder) | |
if: ${{ !contains(matrix.os, 'windows') }} | |
working-directory: pyinstaller | |
run: ./compress.sh hpcflow-${{ needs.bump-version.outputs.new_tag_name }}-${{ matrix.executable_os }}-dir 'onedir' | |
- name: Upload executable artifact (file) | |
uses: actions/upload-artifact@v4 | |
with: | |
name: hpcflow-${{ needs.bump-version.outputs.new_tag_name }}-${{ matrix.executable_os }}${{ matrix.executable_ext }} | |
path: pyinstaller/dist/onefile/hpcflow-${{ needs.bump-version.outputs.new_tag_name }}-${{ matrix.executable_os }}${{ matrix.executable_ext }} | |
- name: Upload executable artifact (compressed folder) | |
uses: actions/upload-artifact@v4 | |
with: | |
name: hpcflow-${{ needs.bump-version.outputs.new_tag_name }}-${{ matrix.executable_os }}-dir.zip | |
path: pyinstaller/dist/onedir/hpcflow-${{ needs.bump-version.outputs.new_tag_name }}-${{ matrix.executable_os }}-dir.zip | |
build-executables-linux: | |
runs-on: ubuntu-latest | |
needs: bump-version | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.base.ref }} # otherwise we get the ref when the workflow started (missing above commit) | |
- name: Cache the virtualenv | |
uses: actions/cache@v4 | |
with: | |
path: ./.venv | |
key: venv-build-CentOS-${{ hashFiles('**/poetry.lock') }} | |
- name: Build executables within Docker | |
uses: addnab/docker-run-action@v3 | |
with: | |
image: ghcr.io/hpcflow/centos7-poetry:latest | |
options: -v ${{ github.workspace }}:/home --env GH_TOKEN=${{ secrets.GITHUB_TOKEN }} | |
run: | | |
# set up poetry | |
cd /home | |
poetry config virtualenvs.in-project true | |
poetry config installer.modern-installation false | |
poetry install --without dev | |
# build with pyinstaller for CentOS (file) | |
cd pyinstaller | |
./make.sh hpcflow-${{ needs.bump-version.outputs.new_tag_name }}-linux INFO onefile | |
cd .. | |
# version check (file) | |
tag=${{ needs.bump-version.outputs.new_tag_name }} | |
tagNoV=${tag:1} | |
hpcflow_vers=$(pyinstaller/dist/onefile/hpcflow-${{ needs.bump-version.outputs.new_tag_name }}-linux --version) | |
hpcflow_vers_expected="hpcFlow, version $tagNoV" | |
echo $hpcflow_vers | |
echo $hpcflow_vers_expected | |
[ "$hpcflow_vers" = "$hpcflow_vers_expected" ] | |
# run test suite on the frozen app (file) | |
pyinstaller/dist/onefile/hpcflow-${{ needs.bump-version.outputs.new_tag_name }}-linux test | |
# build with pyinstaller for CentOS (folder) | |
cd pyinstaller | |
./make.sh hpcflow-${{ needs.bump-version.outputs.new_tag_name }}-linux-dir INFO onedir | |
cd .. | |
# version check (folder) | |
tag=${{ needs.bump-version.outputs.new_tag_name }} | |
tagNoV=${tag:1} | |
hpcflow_vers=$(pyinstaller/dist/onedir/hpcflow-${{ needs.bump-version.outputs.new_tag_name }}-linux-dir/hpcflow-${{ needs.bump-version.outputs.new_tag_name }}-linux-dir --version) | |
hpcflow_vers_expected="hpcFlow, version $tagNoV" | |
echo $hpcflow_vers | |
echo $hpcflow_vers_expected | |
[ "$hpcflow_vers" = "$hpcflow_vers_expected" ] | |
# run test suite on the frozen app (folder) | |
pyinstaller/dist/onedir/hpcflow-${{ needs.bump-version.outputs.new_tag_name }}-linux-dir/hpcflow-${{ needs.bump-version.outputs.new_tag_name }}-linux-dir test | |
# Compress folder (folder) | |
cd pyinstaller | |
./compress.sh hpcflow-${{ needs.bump-version.outputs.new_tag_name }}-linux-dir 'onedir' | |
cd .. | |
- name: Upload executable artifact (file) | |
uses: actions/upload-artifact@v4 | |
with: | |
name: hpcflow-${{ needs.bump-version.outputs.new_tag_name }}-linux | |
path: pyinstaller/dist/onefile/hpcflow-${{ needs.bump-version.outputs.new_tag_name }}-linux | |
- name: Upload executable artifact (compressed folder) | |
uses: actions/upload-artifact@v4 | |
with: | |
name: hpcflow-${{ needs.bump-version.outputs.new_tag_name }}-linux-dir.zip | |
path: pyinstaller/dist/onedir/hpcflow-${{ needs.bump-version.outputs.new_tag_name }}-linux-dir.zip | |
make-workflow-benchmark: | |
needs: bump-version | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: | |
- "3.9" | |
- "3.12" | |
os: | |
- ubuntu-latest | |
- macos-13 | |
- windows-latest | |
num_elements: | |
- 1 | |
- 100 | |
- 10000 | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.ref }} | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install and configure poetry | |
run: | | |
python -m pip install poetry==${{ env.POETRY_VERSION }} | |
poetry config virtualenvs.in-project true | |
poetry config installer.modern-installation false | |
- name: Cache the virtualenv | |
uses: actions/cache@v4 | |
with: | |
path: ./.venv | |
key: ${{ runner.os }}-test-${{ matrix.python-version }}-venv-${{ hashFiles('**/poetry.lock') }} | |
- name: Install dependencies | |
run: | | |
poetry install --without dev,pyinstaller | |
- name: Run app make workflow command | |
run: | | |
poetry run hpcflow --timeit-file benchmark_make_workflow_${{ matrix.num_elements }}_elements-${{ runner.os }}-py-${{ matrix.python-version }}.txt make ./hpcflow/tests/data/benchmark_N_elements.yaml --var N ${{ matrix.num_elements }} | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: benchmark_make_workflow_${{ matrix.num_elements }}_elements-${{ runner.os }}-py-${{ matrix.python-version }}.txt | |
path: benchmark_make_workflow_${{ matrix.num_elements }}_elements-${{ runner.os }}-py-${{ matrix.python-version }}.txt | |
make-workflow-benchmark-upload: | |
needs: make-workflow-benchmark | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.ref }} | |
- run: | | |
mkdir benchmarks | |
- uses: actions/download-artifact@v4 | |
with: | |
merge-multiple: true | |
path: benchmarks | |
- name: zip benchmark results | |
run: | | |
zip -r ./benchmarks.zip benchmarks | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: benchmarks.zip | |
path: benchmarks.zip | |
release-github-PyPI: | |
needs: | |
- bump-version | |
- build-executables | |
- build-executables-linux | |
- make-workflow-benchmark-upload | |
runs-on: ubuntu-latest | |
outputs: | |
binary_download_links: ${{ steps.get_binary_download_links.outputs.binary_download_links }} | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.base.ref }} # otherwise we get the ref when the workflow started (missing above commit) | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.PYTHON_VERSION_RELEASE }} | |
- name: Cache the virtualenv | |
uses: actions/cache@v4 | |
with: | |
path: ./.venv | |
key: venv-release-${{ hashFiles('**/poetry.lock') }} | |
- name: Install poetry | |
run: python -m pip install poetry==${{ env.POETRY_VERSION }} | |
- name: Configure poetry | |
run: | | |
poetry config virtualenvs.in-project true | |
poetry config installer.modern-installation false | |
- name: Install dependencies | |
run: poetry install --without dev,pyinstaller | |
- name: Build (for PyPI) | |
run: | | |
poetry build | |
- run: mkdir release-artifacts | |
- uses: actions/download-artifact@v4 | |
with: | |
path: release-artifacts | |
- uses: actions/download-artifact@v3 # for CentOS (docker) build-exes | |
with: | |
path: release-artifacts | |
- name: Display structure of downloaded files | |
run: ls -R | |
- name: Release | |
id: release | |
uses: softprops/action-gh-release@v2 | |
with: | |
body_path: release-artifacts/CHANGELOG_increment/CHANGELOG_increment.md | |
tag_name: ${{ needs.bump-version.outputs.new_tag_name }} | |
files: | | |
**/hpcflow-${{ needs.bump-version.outputs.new_tag_name }}-win.exe | |
**/hpcflow-${{ needs.bump-version.outputs.new_tag_name }}-macOS | |
**/hpcflow-${{ needs.bump-version.outputs.new_tag_name }}-linux | |
**/hpcflow-${{ needs.bump-version.outputs.new_tag_name }}-win-dir.zip | |
**/hpcflow-${{ needs.bump-version.outputs.new_tag_name }}-macOS-dir.zip | |
**/hpcflow-${{ needs.bump-version.outputs.new_tag_name }}-linux-dir.zip | |
**/benchmarks.zip | |
prerelease: ${{ github.event.pull_request.base.ref == 'develop' }} | |
- name: Release info | |
id: get_binary_download_links | |
run: | | |
binaryYaml=$(python3 -c " | |
from pathlib import Path | |
out_yaml = '' | |
for i in ['win.exe', 'macOS', 'linux', 'win-dir.zip', 'macOS-dir.zip', 'linux-dir.zip']: | |
exe_name = 'hpcflow-${{ needs.bump-version.outputs.new_tag_name }}-' + i | |
url = 'https://github.com/hpcflow/hpcflow-new/releases/download/${{ needs.bump-version.outputs.new_tag_name }}/' + exe_name | |
out_yaml += exe_name + ': ' + url + '\n' | |
print(out_yaml) | |
") | |
# Save multiline output | |
EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64) | |
echo "binary_download_links<<$EOF" >> $GITHUB_OUTPUT | |
echo "$binaryYaml" >> $GITHUB_OUTPUT | |
echo "$EOF" >> $GITHUB_OUTPUT | |
- name: Publish (to https://upload.pypi.org/legacy/) | |
run: | | |
poetry config repositories.pypi https://upload.pypi.org/legacy/ | |
poetry config pypi-token.pypi ${{ secrets.PYPI }} | |
poetry publish --repository pypi | |
build-documentation: | |
needs: release-github-PyPI | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # get all history and tags | |
ref: ${{ github.event.pull_request.base.ref }} # otherwise we get the ref when the workflow started (missing above commit) | |
token: ${{ secrets.HPCFLOW_ACTIONS_TOKEN }} | |
- run: | | |
git config user.name hpcflow-actions | |
git config user.email hpcflow-actions@users.noreply.github.com | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.PYTHON_VERSION_BUILD_DOCS }} | |
- name: Write binary links YAML file and push | |
run: | | |
echo -e "${{ needs.release-github-PyPI.outputs.binary_download_links }}" > docs/source/released_binaries.yml | |
git add . | |
git commit -m "build: update binary download links file [skip ci]" | |
git push | |
- name: Rebase into develop branch if exists (stable release) | |
if: github.event.pull_request.base.ref == 'main' | |
run: | | |
exists_in_remote=$(git ls-remote --heads origin refs/heads/develop) | |
echo "exists_in_remote: $exists_in_remote" | |
if [[ -n $exists_in_remote ]]; then | |
export SKIP=end-of-file-fixer | |
git checkout develop | |
git pull | |
git rebase main | |
git push -u origin develop | |
else | |
echo "No develop branch to merge into." | |
fi | |
- name: Cache the virtualenv | |
uses: actions/cache@v4 | |
with: | |
path: ./.venv | |
key: venv-release-${{ matrix.os }}-${{ hashFiles('**/poetry.lock') }} | |
- name: Install poetry | |
run: python -m pip install poetry==${{ env.POETRY_VERSION }} | |
- name: Configure poetry | |
run: | | |
poetry config virtualenvs.in-project true | |
poetry config installer.modern-installation false | |
- name: Install dependencies | |
run: poetry install --without test,pyinstaller | |
- name: Build documentation with Sphinx | |
run: | | |
cd docs | |
poetry run make clean | |
poetry run make html | |
- name: Upload documentation artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: docs_html | |
path: docs/build/html | |
update-website: | |
needs: [bump-version, release-github-PyPI, build-documentation] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ env.PYTHON_VERSION_UPDATE_WEB }} | |
- uses: actions/checkout@v4 | |
with: | |
repository: hpcflow/hpcflow.github.io | |
token: ${{ secrets.HPCFLOW_ACTIONS_TOKEN }} | |
- run: | | |
git config user.name hpcflow-actions | |
git config user.email hpcflow-actions@users.noreply.github.com | |
- name: Download documentation artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: docs_html | |
path: docs/${{ needs.bump-version.outputs.new_tag_name }} | |
- name: Update stable docs symlink | |
if: github.event.pull_request.base.ref == 'main' | |
run: | | |
ln -sfn ${{ needs.bump-version.outputs.new_tag_name }} docs/stable | |
- name: Update pre-release docs symlink | |
if: github.event.pull_request.base.ref == 'develop' | |
run: | | |
ln -sfn ${{ needs.bump-version.outputs.new_tag_name }} docs/dev | |
- run: | | |
tree | |
- name: Update doc version switcher | |
run: | | |
curl https://raw.githubusercontent.com/hpcflow/hpcflow-new/${{ github.ref_name }}/docs/make_vers_switcher.py --output docs/make_vers_switcher.py | |
python docs/make_vers_switcher.py docs | |
- name: Push changes | |
run: | | |
git add . | |
git commit -m "update content" | |
git push |