comprofix.com/.gitea/workflows/build.yml
Matthew McKinnon 0485a32f04
All checks were successful
/ build-jeykll (push) Successful in 1m35s
/ build-docker (push) Successful in 27s
/ publish (push) Successful in 27s
feat: migrate to jekyll
2024-10-13 15:13:06 +10:00

80 lines
2.1 KiB
YAML

on: push
jobs:
build-jeykll:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Ruby
run: |
apt-get update
apt-get -y install build-essential ruby-full zlib1g-dev
- name: Setup Ruby Path
run: |
export GEM_HOME="$HOME/gems
export PATH="$HOME/gems/bin:$PATH
- name: Setup Jekyll
run: |
gem install jekyll bundler
bundle install
- name: Build with Jekyll
run: |
bundle exec jekyll build
env:
JEKYLL_ENV: production
- uses: actions/upload-artifact@v3
with:
name: comprofix_site
path: _site
build-docker:
runs-on: ubuntu-latest
container:
image: catthehacker/ubuntu:act-latest
needs: build-jeykll
steps:
- uses: actions/download-artifact@v3
with:
name: comprofix_site
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
uses: docker/login-action@v3
with:
registry: git.comprofix.com
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v6
with:
context: ./
file: ./Dockerfile
push: true
tags: git.comprofix.com/mmckinnon/comprofix.com:latest
publish:
runs-on: ubuntu-latest
needs: build-docker
steps:
- name: checkout repo
uses: actions/checkout@v4
- name: Publish Website
run: |
mkdir ~/.ssh
echo "${{ secrets.SSH_KNOWN_HOSTS }}" >> ~/.ssh/known_hosts
chmod 644 ~/.ssh/known_hosts
eval $(ssh-agent -s)
ssh-add <(echo "${{ secrets.SSH_PRIVATE_KEY }}")
ssh administrator@comprofix.com "cd /opt/comprofix; docker compose down" || true
scp docker-compose.yml administrator@comprofix.com:/opt/comprofix
ssh administrator@comprofix.com "cd /opt/comprofix; docker compose pull; docker compose up -d"