Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a release action #497

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ version: 2.1
# Orbs are reusable packages of CircleCI configuration that you may share across projects.
# See: https://circleci.com/docs/2.1/orb-intro/
orbs:
python: circleci/python@1.5.0
python: circleci/python@2.1.1
jobs:
build-docs:
docker:
# A list of available CircleCI Docker convenience images are available here: https://circleci.com/developer/images/image/cimg/python
- image: cimg/python:3.10.13
- image: cimg/python:3.10
steps:
- checkout:
path: docs
Expand Down
46 changes: 45 additions & 1 deletion .github/workflows/build_and_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ jobs:
python -c 'import napari.layers; print(napari.layers.__doc__)'

- name: Create fallback videos
# Only needed for deployment, so should **NOT** be in
# napari/napari/.github/workflows/build_docs.yml
run: |
sudo apt-get update && sudo apt-get install -y ffmpeg
cd docs
Expand Down Expand Up @@ -109,13 +111,55 @@ jobs:
# Downloads to '/home/runner/work/docs/docs/html'
path: html

- name: Deploy Docs
- name: Deploy Dev Docs
if: (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && (startsWith(github.ref, 'refs/tags/v') || startsWith(github.ref, 'refs/heads/main'))
uses: peaceiris/actions-gh-pages@v3
with:
# Note that GITHUB_TOKEN has no permission to access to external repositories.
# When you use deploy_key, set your private key to the repository which
# includes this action as a secret, and set your public key to your external repository.
deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
external_repository: napari/napari.github.io
publish_dir: ./html
publish_branch: gh-pages
destination_dir: ${{ github.event.inputs.target_directory || 'dev' }}
cname: napari.org
keep_files: true

# Because we are using two deploy actions, we need to reset the ssh-agent
# to avoid the following error:
# unix_listener: cannot bind to path /tmp/ssh-auth.sock: Address already in use
# See https://github.com/peaceiris/actions-gh-pages/issues/909
- name: Reset ssh agent
if: (github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && github.event.inputs.target_directory != 'dev'))
run: killall ssh-agent

# Because the actions-gh-pages triggers a pages deployment, it can be some
# time before the repo is updated. We need to wait for the deployment to
# complete before we can create a second deployment, or we will have a git
# conflict. The 5m sleep is completely arbitrary.
- name: Wait for first deployment
if: (github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && github.event.inputs.target_directory != 'dev'))
run: sleep 5m

- name: Deploy Release Docs
if: (github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && github.event.inputs.target_directory != 'dev'))
melissawm marked this conversation as resolved.
Show resolved Hide resolved
uses: peaceiris/actions-gh-pages@v3
with:
deploy_key: ${{ secrets.ACTIONS_DEPLOY_KEY }}
external_repository: napari/napari.github.io
publish_dir: ./html
publish_branch: gh-pages
destination_dir: ${{ github.event.inputs.target_directory || github.event.release.tag_name }}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could potentially create a wrong folder if the wrong version string is passed as input to the action.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure how to validate this entry :(

cname: napari.org
keep_files: true

- name: Set up stable symlink
if: (github.event_name == 'release' || (github.event_name == 'workflow_dispatch' && github.event.inputs.target_directory != 'dev'))
uses: convictional/trigger-workflow-and-wait@v1.6.5
with:
owner: napari
repo: napari.github.io
github_token: ${{ secrets.WORKFLOW_PAT }}
workflow_file_name: symlink-stable.yml
client_payload: '{"target_directory": "${{ github.event.inputs.target_directory || github.event.release.tag_name }}"}'
melissawm marked this conversation as resolved.
Show resolved Hide resolved
Loading