Skip to content

fix: remove sudo for dnf #11

fix: remove sudo for dnf

fix: remove sudo for dnf #11

Workflow file for this run

name: Build
on:
push:
pull_request:
release:
types: [published]
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
test:
runs-on: ubuntu-latest
container: amazonlinux:2
steps:
- name: Install the necessary tools
run: |
yum update -y
yum groupinstall "Development Tools" -y
yum install -y tar wget lzip dnf
- name: Build MuPDF
# https://mupdf.readthedocs.io/en/latest/quick-start-guide.html
run: |
wget https://mupdf.com/downloads/archive/mupdf-1.24.10-source.tar.gz
tar -xzf mupdf-1.24.10-source.tar.gz
cd mupdf-1.24.10-source
make HAVE_X11=no HAVE_GLUT=no prefix=/usr/local install
- name: Create the layer
run: |
mkdir -p layer/bin
cp /usr/local/bin/mutool layer/bin/
cp /usr/local/bin/muraster layer/bin/
mkdir -p layer/lib
ldd /usr/local/bin/mutool | grep '=>' | awk '{print $3}' | xargs -I '{}' cp -v '{}' layer/lib
ldd /usr/local/bin/muraster | grep '=>' | awk '{print $3}' | xargs -I '{}' cp -v '{}' layer/lib
cd layer
zip -r9 ../mutool-layer.zip .
cd ..
- name: Workaround for the nodejs20.x runtime
run: |
dnf -y install nodejs20
mv /opt/actions-runner/externals/node20/bin/node /opt/actions-runner/externals/node20/bin/node-bak
ln -s /usr/bin/node-20 /opt/actions-runner/externals/node20/bin/node
- name: Upload the layer to the github artifact
uses: actions/upload-artifact@v4
with:
name: mutool-layer
path: mutool-layer.zip
- name: Login to AWS
run: |
aws configure set aws_access_key_id ${{ secrets.AWS_ACCESS_KEY_ID }}
aws configure set aws_secret_access_key ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws configure set region ${{ secrets.AWS_REGION }}
- name: Deploy the layer to the artifact registry
run: |
aws lambda publish-layer-version \
--layer-name mutool-layer \
--zip-file fileb://mutool-layer.zip \
--compatible-runtimes nodejs20.x
--region ${{ secrets.AWS_REGION }}