Add new workshops to resources (#29) #60
This file contains hidden or 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: Deploy | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
concurrency: | |
# Skip intermediate builds: always. | |
# Cancel intermediate builds: always. | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
options: | |
name: "Set options" | |
runs-on: ubuntu-latest | |
outputs: | |
deploy: ${{ steps.set-options.outputs.deploy }} | |
preview: ${{ steps.set-options.outputs.preview }} | |
steps: | |
- name: Set options | |
id: set-options | |
run: | | |
# By default always deploy | |
DEPLOY="true" | |
# Create previews only for pull requests | |
if [[ "${{ github.event_name }}" == "pull_request" ]]; then | |
PREVIEW="previews/PR${PRNUM}" | |
# For pull requests, actually deploy only if the PR was opened on the same | |
# repository. | |
if [[ "${{ github.repository }}" != "${{ github.event.pull_request.head.repo.full_name }}" ]]; then | |
DEPLOY="false" | |
fi | |
else | |
PREVIEW="" | |
fi | |
echo "deploy=${DEPLOY}" | |
echo "deploy=${DEPLOY}" >> "${GITHUB_OUTPUT}" | |
echo "preview=${PREVIEW}" | |
echo "preview=${PREVIEW}" >> "${GITHUB_OUTPUT}" | |
env: | |
PRNUM: ${{ github.event.number }} | |
deploy: | |
name: "Build and Deploy" | |
needs: options | |
runs-on: ubuntu-latest | |
permissions: write-all | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: julia-actions/cache@v1 | |
- uses: tlienart/[email protected] | |
with: | |
# NOTE: this is the Xranklin branch the site is built with | |
BRANCH: "dev" | |
# NOTE: this is the base URL prefix (landing page at /$BASE_URL_PREFIX/) | |
BASE_URL_PREFIX: "" | |
# Whether to deploy the website or not. Can do only for PRs opened | |
# from the same repository. | |
DEPLOY: ${{ needs.options.outputs.deploy }} | |
# Directory where to deploy the website. | |
PREVIEW: ${{ needs.options.outputs.preview }} | |
# =================================================================== | |
# DON'T CHANGE THE FOLLOWING UNLESS YOU HAVE GOOD REASONS TO | |
# >> amounts to build(clear=true) when commit message contains [clear] | |
CLEAR_CACHE: ${{ contains(github.event.head_commit.message, '[clear]') }} | |
# >> change the digit at the end if, for some reason, you believe | |
# that the cache used by the github action has an issue | |
CACHE_KEY: "franklin-cache" |