Skip to content

Commit

Permalink
Change pngquant version
Browse files Browse the repository at this point in the history
  • Loading branch information
fuksman committed Dec 23, 2023
1 parent f7eaa89 commit 9ecc000
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 15 deletions.
9 changes: 4 additions & 5 deletions .github/workflows/parse-new-experience.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,10 @@ jobs:
run: |
node tools/prepare-experience.js
rm issue.json
sudo apt-get update
sudo apt-get install -y pngquant
for file in experiences/"${{ env.experience_name }}"/screenshots/*.png; do
pngquant -f "$file" -o "$file"
done
sudo apt update
sudo apt install snapd
sudo snap install pngquant
pngquant --force --ext=.png experiences/${{ env.experience_name }}/screenshots/*.png
file_size=$(stat -c %s "experiences/${{ env.experience_name }}/${{ env.experience_name }}.zip")
jq --arg file_size $file_size '.fileSize = ($file_size|tonumber)' "experiences/${{ env.experience_name }}/manifest.json" > temp.json && mv temp.json "experiences/${{ env.experience_name }}/manifest.json"
rm -f temp.json
Expand Down
20 changes: 10 additions & 10 deletions tools/prepare-experience.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
const fs = require('fs');
const issue = require('../issue.json');
const [issueExperience, issueTitle, issueScreenshot, issueDescription, issueCategories, issueLanguage, issueAuthor, name, id] = Object.values(issue);

const author = "https://github.com/" + issueAuthor;
const name = issue.name
const author = "https://github.com/" + issue.author;
const license = "MIT";
const categories = issueCategories.split(", ");
const categories = issue.categories.split(", ");

var experience = {
$schema: "https://tools.gallery.any.coop/experience.schema.json",
id: id,
id: issue.id,
name: name,
author: author,
license: license,
title: issueTitle,
description: issueDescription,
title: issue.title,
description: issue.description,
categories: categories,
language: issueLanguage,
language: issue.language,
screenshots: [],
downloadLink: "",
fileSize: 0
Expand All @@ -33,7 +33,7 @@ if (fs.existsSync(dir)) {
}

var regex = /https:\/\/github.com\/.*\/.*\/.*\/.*\.zip/g;
const zipLink = issueExperience.match(regex)[0];
const zipLink = issue.experience.match(regex)[0];

if (!zipLink) {
throw new Error(`Experience has no link to zip archive`);
Expand All @@ -50,12 +50,12 @@ const prodDownloadLink = "https://storage.gallery.any.coop/" + name + "/" + name

var regex = /src\s*=\s*"(.+?)"/g;
const extension = "png";
var screenshotLinks = issueScreenshot.match(regex);
var screenshotLinks = issue.screenshots.match(regex);
const screenshotsDir = `${dir}/screenshots`;

if (!screenshotLinks) {
var regex = /\((.*?)\)/g;
screenshotLinks = issueScreenshot.match(regex);
screenshotLinks = issue.screenshots.match(regex);
screenshotLinks = screenshotLinks.map(link => link.replace(/\(|\)/g, ''));
}

Expand Down

0 comments on commit 9ecc000

Please sign in to comment.