feat(ci): deploy manually first #231
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json | |
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions | |
name: Build and deploy pages | |
on: | |
push: | |
branches: [ main ] | |
paths-ignore: | |
- README.md | |
- .gitignore | |
- _config.dev.yml | |
- 'bin/**' | |
- 'scaffolds/**' | |
- 'workflows/**' | |
- 'source/_drafts/**' | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
if: ${{ contains(github.event.head_commit.message, '[deploy]') }} | |
environment: | |
name: production | |
url: https://thom4.net | |
steps: | |
# Setup | |
- uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: '.nvmrc' | |
- run: npm ci | |
# Build | |
- run: npm run build | |
env: | |
NODE_ENV: production | |
# Deploy | |
# - name: Install mc | |
# run: | | |
# wget --quiet https://dl.min.io/client/mc/release/linux-amd64/mc | |
# chmod +x mc | |
# - name: Setup mc | |
# run: ./mc alias set deuxfleurs https://garage.deuxfleurs.fr "${{ secrets.MINIO_ACCESS_KEY_ID }}" ${{ secrets.MINIO_SECRET_ACCESS_KEY }} --api S3v4 | |
# - name: Transfer | |
# run: ./mc mirror --preserve --overwrite --exclude 'talks/*' --exclude 'photography/*' --summary --quiet ./public/ deuxfleurs/thom4.net/ | |
- name: Setup SSH | |
uses: shimataro/ssh-key-action@v2 | |
with: | |
key: "${{ secrets.SSH_PRIVATE_KEY }}" | |
known_hosts: ${{ secrets.SSH_KNOWN_HOSTS }} | |
- name: Transfer | |
run: npm run deploy -- --host ${{ secrets.SSH_HOST }} --user oncletom | |
# Index content | |
- name: Index content on Algolia | |
run: ./node_modules/.bin/hexo algolia --layouts page,reading-note --config _config.yml --indexing-key ${{ secrets.HEXO_ALGOLIA_INDEXING_KEY }} |