Add GitHub CI config
Both for CI and deployment
This commit is contained in:
parent
014138c401
commit
5d8eb0b11c
2 changed files with 108 additions and 0 deletions
51
.github/workflows/ci.yml
vendored
Normal file
51
.github/workflows/ci.yml
vendored
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
name: CI
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- "*"
|
||||||
|
pull_request:
|
||||||
|
|
||||||
|
|
||||||
|
env:
|
||||||
|
FLICKR_API_KEY: ${{ secrets.FLICKR_API_KEY }}
|
||||||
|
FLICKR_USER_ID: ${{ secrets.FLICKR_USER_ID }}
|
||||||
|
UNSPLASH_ACCESS_KEY: ${{ secrets.UNSPLASH_ACCESS_KEY }}
|
||||||
|
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
submodules: true
|
||||||
|
|
||||||
|
- name: Setup Hugo
|
||||||
|
uses: peaceiris/actions-hugo@v2
|
||||||
|
with:
|
||||||
|
hugo-version: '0.79.0'
|
||||||
|
extended: true
|
||||||
|
|
||||||
|
- name: Setup node
|
||||||
|
uses: actions/setup-node@v1
|
||||||
|
with:
|
||||||
|
node-version: '14.x'
|
||||||
|
|
||||||
|
- uses: actions/cache@v1
|
||||||
|
with:
|
||||||
|
path: $HOME/.npm
|
||||||
|
key: npm-${{ hashFiles('package-lock.json') }}
|
||||||
|
|
||||||
|
- name: Install Dependencies
|
||||||
|
run: npm ci
|
||||||
|
|
||||||
|
- name: Dump environment
|
||||||
|
run: env >> .env
|
||||||
|
|
||||||
|
- name: Build site
|
||||||
|
run: ./scripts/release.sh
|
||||||
|
|
||||||
|
- name: Run tests
|
||||||
|
run: ./scripts/test.sh
|
57
.github/workflows/deploy.yml
vendored
Normal file
57
.github/workflows/deploy.yml
vendored
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
name: Deploy
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
|
||||||
|
|
||||||
|
env:
|
||||||
|
FLICKR_API_KEY: ${{ secrets.FLICKR_API_KEY }}
|
||||||
|
FLICKR_USER_ID: ${{ secrets.FLICKR_USER_ID }}
|
||||||
|
UNSPLASH_ACCESS_KEY: ${{ secrets.UNSPLASH_ACCESS_KEY }}
|
||||||
|
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
deploy:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
|
||||||
|
- uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
submodules: true
|
||||||
|
|
||||||
|
- name: Setup Hugo
|
||||||
|
uses: peaceiris/actions-hugo@v2
|
||||||
|
with:
|
||||||
|
hugo-version: '0.79.0'
|
||||||
|
extended: true
|
||||||
|
|
||||||
|
- name: Setup node
|
||||||
|
uses: actions/setup-node@v1
|
||||||
|
with:
|
||||||
|
node-version: '14.x'
|
||||||
|
|
||||||
|
- uses: actions/cache@v1
|
||||||
|
with:
|
||||||
|
path: $HOME/.npm
|
||||||
|
key: npm-${{ hashFiles('package-lock.json') }}
|
||||||
|
|
||||||
|
- name: Install Dependencies
|
||||||
|
run: npm ci
|
||||||
|
|
||||||
|
- name: Dump environment
|
||||||
|
run: env >> .env
|
||||||
|
|
||||||
|
- name: Build site
|
||||||
|
run: ./scripts/release.sh
|
||||||
|
|
||||||
|
- uses: jakejarvis/s3-sync-action@master
|
||||||
|
with:
|
||||||
|
args: --follow-symlinks --delete
|
||||||
|
env:
|
||||||
|
AWS_S3_BUCKET: theorangeone.net
|
||||||
|
AWS_ACCESS_KEY_ID: github
|
||||||
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.MINIO_SECRET_KEY }}
|
||||||
|
SOURCE_DIR: public
|
||||||
|
AWS_S3_ENDPOINT: https://pages.theorangeone.net
|
Loading…
Reference in a new issue