Skip to content

Deploy to Deno Deploy #241

Deploy to Deno Deploy

Deploy to Deno Deploy #241

Workflow file for this run

name: Deploy to Deno Deploy
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events for main or dev
# Deno Deploy project is linked to one branch, usually main, but will
# generate a non-production deploy URL for branches other than main
push:
branches: [ main, dev ]
pull_request:
branches: [ main, dev ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
schedule:
# At 17:05 GMT every day, middle of the night in Japan.
- cron: '5 17 * * *'
# A workflow run is made up of one or more
# jobs that can run sequentially or in parallel
jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest
permissions:
id-token: write # Allows authentication with Deno Deploy.
contents: write # Allows cloning the repo. Need write this time, because we git push
steps:
- name: Clone repository
uses: actions/checkout@v3
with:
submodules: true # Fetch Hugo themes (true or recursive)
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: 'latest' # May fail if there's a breaking change, but just check logs for errors
extended: 'true' # Need extended for anything fancy
- name: Check
run: |
which hugo
hugo version
which jq
- name: Build site public with Hugo
env:
PRODBTOKEN15331: ${{ secrets.PRODBTOKEN15331 }}
run: |
DT=`date +'%Y%m%d-%H%M%S'`
HUGOBASEURL="https://logr.cogley.info"
npm install postcss postcss-cli autoprefixer
cd assets
git clone https://github.com/tachyons-css/tachyons-sass
cd ..
git config --global user.email "rick.cogley@esolia.co.jp"
git config --global user.name "Rick Cogley"
git add .
git diff-index --quiet HEAD || git commit -m "Logr update post $DT"
git push origin main
hugo --gc --minify --verbose --baseURL=$HUGOBASEURL --ignoreCache
- name: Deploy to Deno Deploy
id: deploy # needed to be able to get outputs from this step below
uses: denoland/deployctl@v1
with:
project: logr-cogley-info # the name of the project on Deno Deploy
entrypoint: index.ts # wraps the static output files
root: public # Where the built HTML/CSS/JS files are located.
- name: Check folder contents and output
run: |
ls
echo "====== PUBLIC ======"
ls public
echo "====== STEPS ======"
echo '${{ toJSON(steps) }}'
- name: Ping Slack esolia-websites channel
uses: bryannice/gitactions-slack-notification@2.0.0
env:
SLACK_INCOMING_WEBHOOK: ${{ secrets.SLACK_INCOMING_WEBHOOK }}
SLACK_TITLE: 'Deno Deploy'
SLACK_MESSAGE: 'Git Commit: ${{ github.sha }} on ${{ github.ref }} from ${{ github.repository }}. Deployment URL: ${{ steps.deploy.outputs.url }}'