1
0
Fork 0
mirror of https://github.com/GuerillaStudio/now-playing synced 2024-11-26 06:41:41 +00:00

Add config for Github Actions

This commit is contained in:
Tixie Salander 2024-04-21 22:31:35 +02:00
parent 6fa0de6a77
commit c346044032
No known key found for this signature in database
3 changed files with 57 additions and 3 deletions

45
.github/workflows/deploy-deuxfleurs.yml vendored Normal file
View file

@ -0,0 +1,45 @@
name: Build and deploy on Deuxfleurs infra
on:
workflow_dispatch:
push:
branches: deploy-to-deuxfleurs
jobs:
build_and_publish:
runs-on: ubuntu-latest
env:
HUGO_VERSION: 0.125.2
HUGO_ENV: production
steps:
- name: Checkout
uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
- name: Install Dart Sass
run: sudo snap install dart-sass
- name: Install Hugo CLI
run: |
wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb
- name: Build Hugo
run: |
hugo -b "${{secrets.BASE_URL}}"
- name: Install AWS CLI
uses: unfor19/install-aws-cli-action@v1
- name: Deploy to Deuxfleurs
run: |
touch ~/.awsrc
echo "export AWS_ACCESS_KEY_ID=${{secrets.AWS_ACCESS_KEY_ID}}" >> ~/.awsrc
echo "export AWS_SECRET_ACCESS_KEY=${{secrets.AWS_SECRET_ACCESS_KEY}}" >> ~/.awsrc
echo "export AWS_DEFAULT_REGION='garage'" >> ~/.awsrc
mkdir ~/.aws
touch ~/.aws/credentials
echo "[default]" >> ~/.aws/credentials
echo "aws_access_key_id = ${{secrets.AWS_ACCESS_KEY_ID}}" >> ~/.aws/credentials
echo "aws_secret_access_key = ${{secrets.AWS_SECRET_ACCESS_KEY}}" >> ~/.aws/credentials
echo "region = garage" >> ~/.aws/credentials
function aws { command aws --endpoint-url https://garage.deuxfleurs.fr $@ ; }
aws --version
source ~/.awsrc
aws s3 website now-playing --index-document index.html --error-document 404.html
aws s3 sync --delete public s3://now-playing

View file

@ -1,4 +1,4 @@
baseURL = "http://localhost:1313/"
baseURL = "http://localhost:1312/"
languageCode = "en-us"
title = "Now Playing"
mainSections = ["a"]
@ -17,4 +17,8 @@ disableKinds = ["taxonomy"]
quality = 95
[security]
[security.funcs]
getenv = [ "^HUGO_", "CONTEXT", "URL" ]
getenv = [ "^HUGO_", "CONTEXT", "URL", "BASE_URL" ]
## Deploy into a Garage bucket at Deuxfleurs
[[deployment.targets]]
name = "deuxfleurs"
URL = "s3://now-playing?endpoint=garage.deuxfleurs.fr&region=garage&s3ForcePathStyle=true"

View file

@ -42,8 +42,13 @@
{{ end }}
{{ end }}
{{ $opts := dict
"transpiler" "dartsass"
"vars" site.Params.styles
"enableSourceMap" (not hugo.IsProduction)
}}
{{ $sass := resources.Get "/scss/style.scss" }}
{{ $style := $sass | resources.ToCSS | minify | fingerprint }}
{{ $style := $sass | resources.ToCSS $opts | minify | fingerprint }}
{{ $secureStyle := $style | resources.Fingerprint "sha512" }}
<link rel="preload" href="{{ $secureStyle.Permalink }}" as="style" />
<link rel="stylesheet" href="{{ $secureStyle.Permalink }}" integrity="{{ $secureStyle.Data.Integrity }}">