add robots.txt #51
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
on: | |
push: | |
branches: | |
- 'master' | |
jobs: | |
build_website: | |
permissions: | |
# these permissions are needed to authenticate with gcloud | |
contents: 'read' | |
id-token: 'write' | |
env: | |
# define Hugo cachedir so it is not version dependent | |
HUGO_CACHEDIR: /tmp/hugo_cache | |
IMAGE_NAME: 'lichturm-website' | |
SERVICE_NAME: 'lichturm-website' | |
IMAGE_TAG: 'prod' | |
runs-on: 'ubuntu-latest' | |
steps: | |
# https://github.com/actions/checkout | |
- name: Checkout Repo | |
uses: 'actions/checkout@v4' | |
with: | |
submodules: 'recursive' | |
# https://github.com/peaceiris/actions-hugo | |
- name: Setup Hugo | |
uses: peaceiris/actions-hugo@v3 | |
with: | |
hugo-version: '0.131.0' | |
# cache the hugo output, so that only what has changed has to be regenerated | |
# https://github.com/actions/cache | |
- uses: actions/cache@v4 | |
with: | |
path: ${{ env.HUGO_CACHEDIR }} | |
key: ${{ runner.os }}-hugomod-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-hugomod- | |
- name: Build Website | |
run: 'hugo --minify' | |
# so we can inspect what is being produced | |
# https://github.com/actions/upload-artifact | |
- name: Upload Website as Artifact | |
uses: 'actions/upload-artifact@v4' | |
with: | |
name: 'website' | |
path: './public' | |
#https://github.com/google-github-actions/auth | |
- name: Google Auth | |
id: auth | |
uses: 'google-github-actions/auth@v2' | |
with: | |
token_format: 'access_token' | |
project_id: '${{ secrets.PROJECT_ID }}' | |
service_account: '${{ secrets.SERVICE_ACCOUNT }}' | |
workload_identity_provider: '${{ secrets.WORKLOAD_IDENTITY_PROVIDER }}' | |
# https://github.com/docker/login-action | |
- name: Docker Auth | |
id: 'docker-auth' | |
uses: 'docker/login-action@v3' | |
with: | |
username: 'oauth2accesstoken' | |
password: '${{ steps.auth.outputs.access_token }}' | |
registry: '${{ secrets.CONTAINER_REGISTRY_URL }}-docker.pkg.dev' | |
# https://github.com/docker/setup-qemu-action | |
- name: Set up QEMU | |
uses: 'docker/setup-qemu-action@v3' | |
# https://github.com/docker/setup-buildx-action/tree/master | |
- name: Set up Docker Buildx | |
uses: 'docker/setup-buildx-action@v3' | |
with: | |
buildkitd-flags: '--debug' | |
# https://github.com/docker/build-push-action | |
- name: Build and push image | |
uses: 'docker/build-push-action@v6' | |
with: | |
# we are not using the default git context because that would ignore our hugo build output | |
# see documentation above regarding build context | |
context: . | |
file: './Dockerfile' | |
push: true | |
tags: '${{ secrets.CONTAINER_REGISTRY_URL }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}' | |
# https://github.com/google-github-actions/deploy-cloudrun | |
- name: Deploy Image to Cloud Run | |
id: 'deploy' | |
uses: 'google-github-actions/deploy-cloudrun@v2' | |
with: | |
service: '${{ env.SERVICE_NAME }}' | |
image: '${{ secrets.CONTAINER_REGISTRY_URL }}/${{ env.IMAGE_NAME }}:${{ env.IMAGE_TAG }}' | |
region: '${{ secrets.GCLOUD_REGION }}' | |
# once we are bored of building containers | |
# - name: Install s3cmd | |
# run: | | |
# pip install s3cmd | |
# | |
# - name: Configure s3cmd | |
# run: | | |
# echo '[default]' > ~/.s3cfg | |
# echo 'access_key = ${{ secrets.S3_KEY_ID }}' >> ~/.s3cfg | |
# echo 'secret_key = ${{ secrets.S3_SECRET_KEY }}' >> ~/.s3cfg | |
# echo 'host_base = fsn1.your-objectstorage.com' >> ~/.s3cfg | |
# echo 'host_bucket = %(bucket)s.fsn1.your-objectstorage.com' >> ~/.s3cfg | |
# | |
# - name: Upload files to Hetzner S3 | |
# # with this configuration, the bucket should be specified as e.g. 's3://bucket1' | |
# run: | | |
# s3cmd sync ./public ${{ secrets.S3_BUCKET }} --delete-removed |