Update artifacts #1317
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
#/ | |
# @license Apache-2.0 | |
# | |
# Copyright (c) 2024 The Stdlib Authors. | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software | |
# distributed under the License is distributed on an "AS IS" BASIS, | |
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | |
# See the License for the specific language governing permissions and | |
# limitations under the License. | |
#/ | |
# Workflow name: | |
name: deploy_static | |
# Workflow triggers: | |
on: | |
# Runs on pushes targeting all branches | |
push: | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. | |
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. | |
concurrency: | |
group: "pages" | |
cancel-in-progress: false | |
# Workflow jobs: | |
jobs: | |
# Single deploy job since we're just deploying: | |
deploy: | |
# Define a display name: | |
name: 'Deploy to GitHub Pages' | |
# Define the type of virtual host machine: | |
runs-on: ubuntu-latest | |
# Define environment: | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
steps: | |
# Checkout the repository: | |
- name: 'Checkout repository' | |
# Pin action to full length commit SHA | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
with: | |
# Branch to checkout: | |
ref: 'main' | |
# Specify whether to remove untracked files before checking out the repository: | |
clean: true | |
# Fetch all history: | |
fetch-depth: 0 | |
# Specify whether to download Git-LFS files: | |
lfs: false | |
timeout-minutes: 10 | |
# Checkout all branches into sub-directories: | |
- name: 'Checkout all branches into sub-directories' | |
run: | | |
# Fetch all remote branches: | |
git fetch --all | |
# Create worktrees for all branches: | |
for remote_branch in $(git for-each-ref --format='%(refname:short)' refs/remotes/origin/ | grep -v 'HEAD'); do | |
local_branch="${remote_branch#origin/}" | |
echo "Checking out branch $local_branch" | |
git worktree add "$local_branch" "$remote_branch" | |
done | |
# Remove .git directories from worktrees to avoid deploying them: | |
- name: 'Remove .git directories from worktrees' | |
run: | | |
find . -mindepth 2 -type d -name '.git' -exec rm -rf {} + | |
# Setup the GitHub Pages environment: | |
- name: 'Setup Pages' | |
uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5.0.0 | |
# Upload the artifact: | |
- name: 'Upload artifact' | |
uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3.0.1 | |
with: | |
# Upload entire repository | |
path: '.' | |
# Deploy to GitHub Pages: | |
- name: 'Deploy to GitHub Pages' | |
id: deployment | |
uses: actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e # v4.0.5 |