setting workdirectory to build #9
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
name: Jekyll site CI | |
on: | |
push: | |
branches: [ "prod" ] | |
pull_request: | |
branches: [ "prod" ] | |
jobs: | |
# Build job | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Ruby | |
uses: ruby/setup-ruby@8575951200e472d5f2d95c625da0c7bec8217c42 # v1.161.0 | |
with: | |
# ruby-version: '3.1.0' # Not needed with a .ruby-version file | |
bundler-cache: true # runs 'bundle install' and caches installed gems automatically | |
cache-version: 0 # Increment this number if you need to re-download cached gems | |
- name: Build with Jekyll | |
working-directory: src | |
run: bundle exec jekyll build | |
env: | |
JEKYLL_ENV: production | |
- name: Build with Jekyll | |
working-directory: src | |
run: bundle exec jekyll build | |
env: | |
JEKYLL_ENV: production | |
- name: Upload artifact | |
# Automatically uploads an artifact from the './_site' directory by default | |
uses: actions/upload-artifact@v3 | |
with: | |
name: site | |
path: ./src/_site | |
publish-docker-image: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
- name: Login to github container registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: get artifact | |
uses: actions/download-artifact@v3 | |
with: | |
name: site | |
- name: Build and push Docker Nginx image | |
run: | | |
docker buildx create --use | |
docker buildx build \ | |
--cache-from ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}-nginx:latest \ | |
--tag ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}-nginx:latest \ | |
--platform linux/amd64,linux/arm64 \ | |
--push \ | |
--file Dockerfile.nginx . |