Compare commits

...

10 commits

Author SHA1 Message Date
fleaz
b7866414a9 ci: Switch to forgejo
Some checks are pending
Deployment / build (push) Waiting to run
2025-03-16 01:56:20 +01:00
fleaz
9108e1e50c
Add error handling 2024-05-23 00:05:00 +02:00
fleaz
c930e9e92a
ci: move apt into seperat job 2024-05-22 23:56:27 +02:00
fleaz
7ab5644822
ci: I can haz root? 2024-05-22 23:52:58 +02:00
fleaz
0c8e10f043
ci: Fix ghostscript 2024-05-22 23:45:47 +02:00
fleaz
7b3bd5fee8
ci: debug 2024-05-22 23:07:14 +02:00
fleaz
2bd45309a2
Revert "ci: Newer ubuntu image"
This reverts commit 8df579e1f5.
2024-05-22 23:05:47 +02:00
fleaz
8df579e1f5
ci: Newer ubuntu image 2024-05-22 22:55:51 +02:00
fleaz
2a3a1992b8
ci: Fix typo 2024-05-22 22:21:39 +02:00
fleaz
55fa1b6db4 ci: Fix typo 2024-05-10 20:06:13 +02:00
3 changed files with 21 additions and 39 deletions

View file

@ -14,23 +14,31 @@ jobs:
- name: Set up Go - name: Set up Go
uses: actions/setup-go@v2 uses: actions/setup-go@v2
with: with:
go-version: 1.21 go-version: 1.23
- name: Install dependencies
run: |
sudo apt install pkg-config libmagickwand-dev imagemagick gcc libc-dev
- name: Patch ghostsccript thanks to CVE-2018-16509
run: |
sudo sed -i '$i<policy domain="coder" rights="read | write" pattern="PDF" />' /etc/ImageMagick-6/policy.xml
- name: Build - name: Build
run: | run: |
sudo apt install pkg-config libmagickwand-dev imagemagick gcc libc-dev
mkdir {previews,dist} mkdir {previews,dist}
go run main.go go run main.go
ls -laR
mv index.html dist/ mv index.html dist/
mv previews/ dist/ mv previews/ dist/
mv talks/ dist/ mv talks/ dist/
- uses: jakejarvis/s3-sync-action@master - uses: https://github.comjakejarvis/s3-sync-action@master
with: with:
args: --delete args: --delete
env: env:
AWS_S3_BUCKET: "slidec.fleaz.me" AWS_S3_BUCKET: "slides.fleaz.me"
AWS_ACCESS_KEY_ID: ${{ secrets.ACCESS_KEY }} AWS_ACCESS_KEY_ID: ${{ secrets.ACCESS_KEY }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.SECRET_KEY }} AWS_SECRET_ACCESS_KEY: ${{ secrets.SECRET_KEY }}
AWS_S3_ENDPOINNT: "https://s3.fleaz.me" AWS_S3_ENDPOINT: "https://s3.fleaz.me"
SOURCE_DIR: 'dist' SOURCE_DIR: 'dist'

View file

@ -1,32 +0,0 @@
cache:
untracked: true
paths:
- node_modules/
stages:
- build
- deploy
build:
stage: build
image: golang:1-alpine
artifacts:
paths:
- dist
script:
- apk add --no-cache imagemagick pkgconfig imagemagick-dev gcc libc-dev
- rm -rf previews && mkdir -p previews
- rm -rf dist && mkdir -p dist
- go run main.go
- mv index.html dist/
- mv previews/ dist/
- mv talks/ dist/
deploy:
stage: deploy
image: node:16-alpine
script:
- npm i -g netlify-cli
- netlify deploy --site $NETLIFY_SITE_ID --auth $NETLIFY_AUTH_TOKEN --prod
rules:
- if: '$CI_COMMIT_BRANCH == "master"'

10
main.go
View file

@ -23,10 +23,16 @@ func generatePreview(path string) Talk {
imagePath := fmt.Sprintf("previews/%s.jpg", result[1]) imagePath := fmt.Sprintf("previews/%s.jpg", result[1])
mw := imagick.NewMagickWand() mw := imagick.NewMagickWand()
defer mw.Destroy() defer mw.Destroy()
mw.ReadImage(path) err := mw.ReadImage(path)
if err != nil {
panic(err)
}
mw.SetIteratorIndex(0) mw.SetIteratorIndex(0)
mw.SetImageFormat("jpg") mw.SetImageFormat("jpg")
mw.WriteImage(imagePath) err = mw.WriteImage(imagePath)
if err != nil {
panic(err)
}
return Talk{Title: result[1], Preview: imagePath, Path: path, Description: "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua."} return Talk{Title: result[1], Preview: imagePath, Path: path, Description: "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua."}
} }