Compare commits
10 commits
a0e98b81c1
...
b7866414a9
Author | SHA1 | Date | |
---|---|---|---|
![]() |
b7866414a9 | ||
![]() |
9108e1e50c | ||
![]() |
c930e9e92a | ||
![]() |
7ab5644822 | ||
![]() |
0c8e10f043 | ||
![]() |
7b3bd5fee8 | ||
![]() |
2bd45309a2 | ||
![]() |
8df579e1f5 | ||
![]() |
2a3a1992b8 | ||
![]() |
55fa1b6db4 |
3 changed files with 21 additions and 39 deletions
|
@ -14,23 +14,31 @@ jobs:
|
|||
- name: Set up Go
|
||||
uses: actions/setup-go@v2
|
||||
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
|
||||
run: |
|
||||
sudo apt install pkg-config libmagickwand-dev imagemagick gcc libc-dev
|
||||
mkdir {previews,dist}
|
||||
go run main.go
|
||||
ls -laR
|
||||
mv index.html dist/
|
||||
mv previews/ dist/
|
||||
mv talks/ dist/
|
||||
|
||||
- uses: jakejarvis/s3-sync-action@master
|
||||
- uses: https://github.comjakejarvis/s3-sync-action@master
|
||||
with:
|
||||
args: --delete
|
||||
env:
|
||||
AWS_S3_BUCKET: "slidec.fleaz.me"
|
||||
AWS_S3_BUCKET: "slides.fleaz.me"
|
||||
AWS_ACCESS_KEY_ID: ${{ secrets.ACCESS_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'
|
|
@ -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
10
main.go
|
@ -23,10 +23,16 @@ func generatePreview(path string) Talk {
|
|||
imagePath := fmt.Sprintf("previews/%s.jpg", result[1])
|
||||
mw := imagick.NewMagickWand()
|
||||
defer mw.Destroy()
|
||||
mw.ReadImage(path)
|
||||
err := mw.ReadImage(path)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
mw.SetIteratorIndex(0)
|
||||
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."}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue