Skip to content

Deploy website to GitHub Pages #287

Deploy website to GitHub Pages

Deploy website to GitHub Pages #287

Workflow file for this run

# Copyright 2023 Google LLC
#
# 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.
# https://github.com/actions/starter-workflows/blob/main/pages/static.yml
name: Deploy website to GitHub Pages
on:
# Runs when new semantic version tags are created.
push:
tags:
- 'v*.*.*'
- '!v*.*.*-*' # Ignore pre-release identifiers like 1.4.0-beta.
# 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 one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: true
jobs:
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.21
- name: Cache addlicense
uses: actions/cache@v3
with:
path: ~/go/bin/addlicense
key: addlicense-v1.1.1
# docgen.go requires addlicense.
- name: Install addlicense
run: go install github.com/google/addlicense@v1.1.1
- name: Build site
run: go run dev/docgen/docgen.go
- name: Setup Pages
uses: actions/configure-pages@v3
# Set the right file permissions, based on https://github.com/actions/upload-pages-artifact#file-permissions.
- shell: sh
run: |
chmod -c -R +rX "website/public" |
while read line; do
echo "::warning title=Invalid file permissions automatically fixed::$line"
done
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: 'website/public'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1