GHA: do not need sudo in container #57
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
# This is a basic workflow to help you get started with Actions | |
name: CI | |
# Controls when the action will run. Triggers the workflow on push or pull request | |
# events but only for the source branch | |
on: | |
push: | |
branches: [ source ] | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
# This workflow contains a single job called "build" | |
build: | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
container: | |
image: debian:trixie | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
- name: Install pre-reqs | |
run: | | |
apt-get install git | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
submodules: 'recursive' | |
- name: Cache deps | |
uses: actions/cache@v3 | |
env: | |
cache-name: cache-ikiwiki-deps | |
with: | |
path: | | |
~/perl5 | |
~/.ruby | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.sha }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-name }}- | |
- name: Install ikiwiki | |
run: | | |
apt-get install \ | |
ikiwiki \ | |
libtext-multimarkdown-perl \ | |
libimage-magick-perl \ | |
librsvg2-bin \ | |
cpanminus \ | |
libhighlight-perl \ | |
latexml \ | |
tex4ht \ | |
biber \ | |
texlive-bibtex-extra \ | |
texlive-latex-base \ | |
texlive-latex-extra \ | |
texlive-latex-recommended \ | |
texlive-pictures \ | |
graphviz | |
# not latest version | |
#apt-get install \ | |
#tj3 | |
apt-get install \ | |
dvipng # for teximg plugin | |
apt-get install \ | |
mupdf-tools # for mutool | |
cpanm --local-lib=~/perl5 local::lib && eval $(perl -I ~/perl5/lib/perl5/ -Mlocal::lib) | |
cpanm -n YAML::Any YAML::XS Sort::Naturally LaTeXML | |
mkdir -p ~/.ruby | |
export GEM_HOME=~/.ruby | |
echo "GEM_HOME=$GEM_HOME" >> $GITHUB_ENV | |
echo "$GEM_HOME/bin" >> $GITHUB_PATH | |
gem install taskjuggler | |
- name: Set up worktree and Run ikiwiki | |
run: | | |
git config extensions.worktreeConfig true | |
git worktree add -B master ../_site origin/master | |
eval $(perl -I ~/perl5/lib/perl5/ -Mlocal::lib) | |
export PERL5LIB="$PERL5LIB:./.ikiwiki-plugins/rubykat-ikiplugins" | |
export PERL5LIB="$PERL5LIB:./.ikiwiki-plugins/p5-IkiWiki-Plugin-github/lib" | |
export PERL5LIB="$PERL5LIB:./.ikiwiki-plugins/p5-IkiWiki-Plugin-tex/lib" | |
export PERL5LIB="$PERL5LIB:./.ikiwiki-plugins/p5-IkiWiki-Plugin-taskjuggler/lib" | |
export PERL5LIB="$PERL5LIB:./.ikiwiki-plugins/ikiwiki-uml" | |
ikiwiki --setup project-renard.setup | |
- name: Commit to master | |
run: | | |
cd ../_site | |
git config --worktree push.default simple | |
git config --worktree user.name github-actions | |
git config --worktree user.email github-actions@github.com | |
COMMIT_MESSAGE="Publishing site on `date "+%Y-%m-%d %H:%M:%S"` from `git log -n 1 --format='commit %h - %s' $GITHUB_SHA`" | |
git add --all && git commit -m "$COMMIT_MESSAGE" && git push origin master | |
- name: Push checkout back | |
run: | | |
cd $GITHUB_WORKSPACE | |
git push |