2024-05-15 07:22:46 +00:00
|
|
|
name: Jekyll
|
|
|
|
run-name: ${{ gitea.actor }} is running some Gitea Actions 🚀
|
|
|
|
on: [push]
|
|
|
|
|
|
|
|
jobs:
|
2024-05-15 07:44:19 +00:00
|
|
|
test-ci-actions:
|
2024-05-22 10:23:10 +00:00
|
|
|
runs-on: ubuntu-22.04
|
2024-05-15 07:22:46 +00:00
|
|
|
steps:
|
2024-05-22 15:06:54 +00:00
|
|
|
- name: Verify setup
|
|
|
|
id: verify_setup
|
|
|
|
run: |
|
|
|
|
env | sort
|
2024-05-15 07:22:46 +00:00
|
|
|
- name: Check out repository code
|
2024-05-15 07:44:19 +00:00
|
|
|
id: checkout
|
2024-05-15 07:22:46 +00:00
|
|
|
uses: actions/checkout@v4
|
2024-05-22 12:57:55 +00:00
|
|
|
- name: Fix file permissions
|
|
|
|
id: fix_permissions
|
|
|
|
run: |
|
2024-05-22 13:00:16 +00:00
|
|
|
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}"; }
|
2024-05-22 12:57:55 +00:00
|
|
|
chown -R ubuntu:ubuntu .
|
2024-05-15 07:57:11 +00:00
|
|
|
- name: Install docker
|
|
|
|
id: install_docker
|
|
|
|
run: |
|
2024-05-22 11:52:09 +00:00
|
|
|
apt-get -q update
|
|
|
|
apt-get -q install -y docker-compose
|
|
|
|
apt-get -q clean
|
2024-05-15 07:57:11 +00:00
|
|
|
- name: Verify docker
|
2024-05-15 07:44:19 +00:00
|
|
|
id: verify_docker
|
|
|
|
run: |
|
|
|
|
docker run --rm hello-world:latest > /dev/null
|
|
|
|
docker rmi hello-world:latest > /dev/null
|
|
|
|
docker version
|
2024-05-22 14:22:52 +00:00
|
|
|
docker-compose version
|
2024-05-22 13:58:38 +00:00
|
|
|
docker volume ls
|
2024-05-22 12:30:15 +00:00
|
|
|
- name: Build Jekyll image
|
|
|
|
id: build_image
|
|
|
|
run: |
|
2024-05-22 12:50:47 +00:00
|
|
|
docker-compose build jekyll
|
2024-05-22 13:47:42 +00:00
|
|
|
- name: Verify Jekyll container
|
|
|
|
id: verify_image
|
|
|
|
run: |
|
2024-05-22 15:16:39 +00:00
|
|
|
set -x
|
2024-05-22 15:14:03 +00:00
|
|
|
docker volume inspect "${JOB_CONTAINER_NAME}"
|
|
|
|
docker volume inspect "${JOB_CONTAINER_NAME}-env"
|
2024-05-22 15:12:11 +00:00
|
|
|
docker-compose run --rm --entrypoint bash -v "${JOB_CONTAINER_NAME}:/home/ubuntu/workspace" jekyll -c "whoami; pwd; ls -lA ."
|
2024-05-22 12:34:17 +00:00
|
|
|
- name: Build Jekyll site
|
2024-05-22 12:30:15 +00:00
|
|
|
id: build_site
|
|
|
|
run: |
|
2024-05-22 15:12:11 +00:00
|
|
|
docker-compose run --rm -v "${JOB_CONTAINER_NAME}:/home/ubuntu/workspace" jekyll build --verbose
|
2024-05-22 14:34:11 +00:00
|
|
|
- name: Upload Jekyll site
|
2024-05-22 15:06:54 +00:00
|
|
|
id: upload_site
|
2024-05-22 14:34:11 +00:00
|
|
|
uses: "actions/upload-artifact@v3"
|
|
|
|
with:
|
|
|
|
name: jekyll-site
|
|
|
|
path: _site
|
|
|
|
if-no-files-found: error
|
2024-05-22 15:06:54 +00:00
|
|
|
- name: Verify site
|
|
|
|
id: verify_site
|
|
|
|
run: |
|
|
|
|
echo "${{ steps.upload_site.outputs.artifact-url }}"
|