66 lines
2.2 KiB
YAML
66 lines
2.2 KiB
YAML
name: Jekyll
|
|
run-name: ${{ gitea.actor }} is running some Gitea Actions 🚀
|
|
on: [push]
|
|
|
|
jobs:
|
|
test-ci-actions:
|
|
runs-on: ubuntu-22.04
|
|
steps:
|
|
- name: Verify setup
|
|
id: verify_setup
|
|
run: |
|
|
env | sort
|
|
- name: Check out repository code
|
|
id: checkout
|
|
uses: actions/checkout@v4
|
|
- name: Fix file permissions
|
|
id: fix_permissions
|
|
run: |
|
|
export uid=1000
|
|
export gid=1000
|
|
export user=ubuntu
|
|
export group=ubuntu
|
|
id ${user} > /dev/null 2>&1 && \
|
|
{ groupmod -g "${gid}" "${group}" && usermod -md /home/${user} -s /bin/bash -g "${group}" -u "${uid}" "${user}"; } || \
|
|
{ groupadd -g "${gid}" "${group}" && useradd -md /home/${user} -s /bin/bash -g "${group}" -u "${uid}" "${user}"; }
|
|
chown -R ubuntu:ubuntu .
|
|
- name: Install docker
|
|
id: install_docker
|
|
run: |
|
|
apt-get -q update
|
|
apt-get -q install -y docker-compose
|
|
apt-get -q clean
|
|
- name: Verify docker
|
|
id: verify_docker
|
|
run: |
|
|
docker run --rm hello-world:latest > /dev/null
|
|
docker rmi hello-world:latest > /dev/null
|
|
docker version
|
|
docker-compose version
|
|
docker volume ls
|
|
- name: Build Jekyll image
|
|
id: build_image
|
|
run: |
|
|
docker-compose build jekyll
|
|
- name: Verify Jekyll container
|
|
id: verify_image
|
|
run: |
|
|
docker volume inspect "${JOB_CONTAINER_NAME}"
|
|
docker volume inspect "${JOB_CONTAINER_NAME}-env"
|
|
docker-compose run --rm --entrypoint bash -v "${JOB_CONTAINER_NAME}:/home/ubuntu/workspace" jekyll -c "whoami; pwd; ls -lA ."
|
|
- name: Build Jekyll site
|
|
id: build_site
|
|
run: |
|
|
docker-compose run --rm -v "${JOB_CONTAINER_NAME}:/home/ubuntu/workspace" jekyll build --verbose
|
|
- name: Upload Jekyll site
|
|
id: upload_site
|
|
uses: "actions/upload-artifact@v3"
|
|
with:
|
|
name: jekyll-site
|
|
path: _site
|
|
if-no-files-found: error
|
|
- name: Verify site
|
|
id: verify_site
|
|
run: |
|
|
echo "${{ steps.upload_site.outputs.artifact-url }}"
|