Skip to content

deploy

deploy #139

Workflow file for this run

name: deploy
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * 5' # Runs at 00:00 UTC every Friday
push:
branches: main
jobs:
spotify-fetch:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: lauravuo/spotify-box@main
env:
SPOTIFY_CLIENT_ID: ${{ secrets.SPOTIFY_CLIENT_ID }}
SPOTIFY_CLIENT_SECRET: ${{ secrets.SPOTIFY_CLIENT_SECRET }}
SPOTIFY_REFRESH_TOKEN: ${{ secrets.SPOTIFY_REFRESH_TOKEN }}
- run: |
git config --global user.email "spotify-bot"
git config --global user.name "spotify-bot"
cp tracks.md hugo-site/content/index.md
git add tracks.*
git commit -a -m "Add latest tracks."
git push
deploy:
needs: spotify-fetch
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
with:
ref: main
submodules: recursive
fetch-depth: 1
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: '0.91.2'
extended: true
# - uses: actions/setup-node@v2
# with:
# node-version: '14.x'
# - name: install deps
# run: cd hugo-site && npm ci
- name: Build
run: cd hugo-site && hugo --minify
- name: Test
run: ./test/verify.sh ./hugo-site/public/index.html
- name: Version
run: |
VERSION_NBR=$(cat VERSION)
NEW_VERSION="${VERSION_NBR%.*}.$((${VERSION_NBR##*.} + 1))"
echo "$NEW_VERSION" > VERSION
git config --global user.email "deploy-bot"
git config --global user.name "deploy-bot"
git commit -a -m "Update version to $NEW_VERSION."
git push
echo "$(cat VERSION) "$(date)"" > ./hugo-site/public/version.txt
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./hugo-site/public
verify-site:
needs: deploy
runs-on: ubuntu-latest
env:
DEPLOY_URL: https://lauravuo.github.io/my-heart-music/
steps:
- uses: actions/checkout@v2
with:
ref: main
- run: ./test/version.sh $DEPLOY_URL
- run: ./test/verify.sh $DEPLOY_URL