feat(ci)🐳: Add Docker image build step to deployment workflow #104
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
# This GitHub workflow runs only on push to master. | |
# By this point, we are assuming that all checks on the PR, | |
# which are checked by the Azure Pipeline, have passed. | |
# The full pipeline is also leveraged here, | |
# as we don't want a broken website to be deployed anyways. | |
name: Deployments | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
jobs: | |
build-and-deploy-website: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: prefix-dev/[email protected] | |
with: | |
pixi-version: v0.41.4 | |
cache: true | |
- name: Build website | |
run: | | |
pixi run python -m ipykernel install --user --name nams | |
pixi run build-docs | |
- name: Deploy Website | |
if: github.event_name == 'push' && github.ref == 'refs/heads/master' | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
# https://github.com/peaceiris/actions-gh-pages#%EF%B8%8F-set-personal-access-token-personal_token | |
personal_token: ${{ secrets.GHPAGES_TOKEN }} | |
publish_dir: ./site | |
publish_branch: gh-pages | |
allow_empty_commit: false | |
keep_files: false | |
force_orphan: true | |
enable_jekyll: false | |
disable_nojekyll: false | |
- name: Deploy preview | |
uses: rossjrw/pr-preview-action@v1 | |
if: github.event_name == 'pull_request' | |
with: | |
source-dir: ./site | |
build-docker-image: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: prefix-dev/[email protected] | |
with: | |
pixi-version: v0.41.4 | |
cache: true | |
- name: Build Docker image | |
run: | | |
docker build -t nams-docker -f scripts/Dockerfile . | |
# - name: Download environment tarball | |
# uses: actions/download-artifact@v3 | |
# with: | |
# name: nams-tarball | |
# - name: Unpack environment and activate it | |
# run: bash scripts/ci/unpack_environment.sh | |
# - name: Build leanpub manuscript files | |
# run: | | |
# bash scripts/ci/build_leanpub.sh | |
# - name: Deploy Leanpub | |
# uses: peaceiris/actions-gh-pages@v3 | |
# with: | |
# # https://github.com/peaceiris/actions-gh-pages#%EF%B8%8F-set-personal-access-token-personal_token | |
# personal_token: ${{ secrets.GHPAGES_TOKEN }} | |
# publish_dir: ./manuscript | |
# publish_branch: leanpub | |
# destination_dir: manuscript | |
# allow_empty_commit: false | |
# keep_files: false | |
# force_orphan: true | |
# enable_jekyll: false | |
# disable_nojekyll: false | |
# - name: Trigger publish on LeanPub | |
# run: curl -d "api_key=${{ secrets.LEANPUB_API_KEY }}" https://leanpub.com/nams/publish.json |