From 662f9dab410b3e1bfefd95308a9f549d4e427c86 Mon Sep 17 00:00:00 2001 From: Johan Van de Wauw Date: Wed, 18 Sep 2024 23:09:43 +0200 Subject: [PATCH] Build the website in github actions Idea is that more people can contribute to the website and build without having to setup a whole pipeline. Once pretalx publishes its yaml we can have a second test on that instead of the demo version. The container was built and pushed to my package repository because it seems github does not allow pushing packages when using fine grained pats ( https://github.com/github/roadmap/issues/558 ). If someone can get it at FOSDEM, that seems a better place. --- .github/workflows/website.yml | 41 +++++++++++++++++++++++++++++++++++ Dockerfile | 8 +++---- 2 files changed, 44 insertions(+), 5 deletions(-) create mode 100644 .github/workflows/website.yml diff --git a/.github/workflows/website.yml b/.github/workflows/website.yml new file mode 100644 index 000000000..c61c3847f --- /dev/null +++ b/.github/workflows/website.yml @@ -0,0 +1,41 @@ +name: Build FOSDEM site + +on: + push: + branches: + - master + - gha + pull_request: + branches: + - master + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Copy test penta/pretalx export + run: | + mv sample/export . + - name: Ensure pdf_grid is set to false in config.yaml + run: | + sed -i '/^pdf_grid/d' config.yaml + echo "pdf_grid: false" >> config.yaml + + + - name: Run nanoc build in docker + uses: docker://ghcr.io/johanvdw/fosdem-website + with: + entrypoint: /bin/sh + args: -c "bundle install && nanoc" + + # Step 5: Upload the 'output' directory as an artifact + - name: Upload output directory + uses: actions/upload-artifact@v4 + with: + name: nanoc-output + path: output + diff --git a/Dockerfile b/Dockerfile index 951cd647e..5f946fe97 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,19 +8,17 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -yq \ krb5-user # Copy the Gemfile in and bundle, so we have the dependencies cached -ADD Gemfile . -ADD Gemfile.lock . +COPY Gemfile Gemfile.lock . RUN gem install bundler:1.17.3 && bundle install # Set encoding to prevent nanoc exploding ENV LANG=C.UTF-8 ENV APP_DIR=/usr/src/app -# Copy the rest of the app in -ADD . $APP_DIR - # Port 3000 is used for `nanoc view` EXPOSE 3000 WORKDIR $APP_DIR ENTRYPOINT ["bundle", "exec"] + +LABEL org.opencontainers.image.source https://github.com/FOSDEM/website CMD ['nanoc', 'view']