Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
coretl committed Feb 9, 2024
1 parent ad6d985 commit 2771891
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 23 deletions.
2 changes: 1 addition & 1 deletion .copier-answers.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Changes here will be overwritten by Copier
_commit: 1.0.2-47-gb4a4a29
_commit: 1.0.2-51-g189eebc
_src_path: gh:DiamondLightSource/python-copier-template
author_email: tom.cobb@diamond.ac.uk
author_name: Tom Cobb
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/install_requirements/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ inputs:
default: "dev"
pip-install:
description: Parameters to pass to pip install
default: "-e .[dev]"
default: "$([ -f dev-requirements.txt ] && echo '-c dev-requirements.txt') -e .[dev]"

runs:
using: composite
Expand Down
19 changes: 8 additions & 11 deletions .github/workflows/_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,23 +28,20 @@ jobs:
- name: Remove environment.pickle
run: rm build/html/.doctrees/environment.pickle

- name: Sanitize ref name for docs version
run: echo "DOCS_VERSION=${GITHUB_REF_NAME//[^A-Za-z0-9._-]/_}" >> $GITHUB_ENV

- name: Move to versioned directory
run: mv build/html build/$DOCS_VERSION

- name: Upload built docs artifact
uses: actions/upload-artifact@v4
with:
name: docs
path: build

- name: Add other static pages files
run: cp .github/pages/* build
- name: Sanitize ref name for docs version
run: echo "DOCS_VERSION=${GITHUB_REF_NAME//[^A-Za-z0-9._-]/_}" >> $GITHUB_ENV

- name: Move to versioned directory
run: mv build/html .github/pages/$DOCS_VERSION

- name: Write switcher.json
run: python .github/pages/make_switcher.py --add $DOCS_VERSION ${{ github.repository }} build/switcher.json
run: python .github/pages/make_switcher.py --add $DOCS_VERSION ${{ github.repository }} .github/pages/switcher.json

- name: Publish Docs to gh-pages
if: github.ref_type == 'tag' || github.ref_name == 'main'
Expand All @@ -53,5 +50,5 @@ jobs:
uses: peaceiris/actions-gh-pages@373f7f263a76c20808c831209c920827a82a2847 # v3.9.3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: build
keep_files: true
publish_dir: .github/pages
keep_files: true
19 changes: 9 additions & 10 deletions .github/workflows/_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,16 @@ jobs:
steps:
- name: Download artifacts
uses: actions/download-artifact@v4
with:
merge-multiple: true

- name: Prepare release files
- name: Zip up docs
run: |
if [ -d docs ]; then
cd docs && zip -r docs.zip *
echo 'DOCS=docs/docs.zip' >> $GITHUB_ENV
fi
if [ -d dist ]; then
echo 'DIST=dist/*' >> $GITHUB_ENV
set -vxeuo pipefail
if [ -d html ]; then
mv html $GITHUB_REF_NAME
zip -r docs.zip $GITHUB_REF_NAME
rm -rf $GITHUB_REF_NAME
fi
- name: Create GitHub Release
Expand All @@ -25,9 +26,7 @@ jobs:
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844 # v0.1.15
with:
prerelease: ${{ contains(github.ref_name, 'a') || contains(github.ref_name, 'b') || contains(github.ref_name, 'rc') }}
files: |
${{ env.DOCS }}
${{ env.DIST }}
files: "*"
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
11 changes: 11 additions & 0 deletions .github/workflows/_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,17 @@ jobs:
name: Install dev versions of python packages
uses: ./.github/actions/install_requirements

- if: inputs.python-version == 'dev'
name: Write the requirements as an artifact
run: pip freeze --exclude-editable > /tmp/dev-requirements.txt

- if: inputs.python-version == 'dev'
name: Upload dev-requirements.txt
uses: actions/upload-artifact@v4
with:
name: dev-requirements
path: /tmp/dev-requirements.txt

- if: inputs.python-version != 'dev'
name: Install latest versions of python packages
uses: ./.github/actions/install_requirements
Expand Down

0 comments on commit 2771891

Please sign in to comment.