Build and publish blog with Actions

This commit is contained in:
techknowlogick 2023-04-13 11:09:49 -04:00
parent 9978b12eac
commit 087f2f93ee
5 changed files with 62 additions and 57 deletions

View file

@ -1,60 +1,3 @@
---
kind: pipeline
type: docker
name: Build and deploy live website
platform:
os: linux
arch: arm64
workspace:
base: /srv/app
path: src
steps:
- name: build
pull: always
image: golang:1.19
commands:
- make clean
- make build
- name: publish
pull: always
image: techknowlogick/drone-netlify:latest
settings:
path: public/
site_id: b3cd7cc2-68be-4467-b3a6-38f1fdfa0cfc
environment:
NETLIFY_TOKEN:
from_secret: netlify_token
when:
event:
- push
- name: discord
pull: always
image: appleboy/drone-discord:1
environment:
DISCORD_WEBHOOK_ID:
from_secret: discord_webhook_id
DISCORD_WEBHOOK_TOKEN:
from_secret: discord_webhook_token
when:
event:
- push
- tag
status:
- changed
- failure
trigger:
branch:
- main
event:
exclude:
- pull_request
---
kind: pipeline
type: docker

View file

@ -0,0 +1,37 @@
name: build and publish
on:
push:
branches:
- main
jobs:
lint:
name: build and publish
runs-on: ubuntu-latest
steps:
- 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: https://github.com/peaceiris/actions-hugo@v2
with:
hugo-version: '0.111.3'
extended: true
- name: setup go
uses: https://github.com/actions/setup-go@v4
with:
go-version: '>=1.20.1'
- name: Build
run: |
make clean
make build
- name: publish to netlify
uses: https://github.com/nwtgck/actions-netlify@v2.0
with:
publish-dir: public
production-branch: main
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: b3cd7cc2-68be-4467-b3a6-38f1fdfa0cfc

View file

@ -0,0 +1,25 @@
name: check-and-test
on:
- push
- pull_request
jobs:
check-and-test:
runs-on: ubuntu-latest
steps:
steps:
- uses: actions/checkout@v3
- name: Setup Hugo
uses: https://github.com/peaceiris/actions-hugo@v2
with:
hugo-version: '0.111.3'
extended: true
- name: setup go
uses: https://github.com/actions/setup-go@v4
with:
go-version: '>=1.20.1'
- name: Build
run: |
make clean
make build