refactor: optimized workflow

This commit is contained in:
snus xD
2025-12-24 10:53:43 +03:00
parent 3f7cf29c00
commit f516b4a2af
4 changed files with 22 additions and 56 deletions

View File

@@ -6,35 +6,43 @@ on:
- "_sprites/**" - "_sprites/**"
- "scripts/**" - "scripts/**"
concurrency:
group: sorting-${{ github.ref }}
cancel-in-progress: true
permissions: permissions:
contents: write contents: write
actions: write
jobs: jobs:
run-scripts: run-scripts:
if: github.actor != 'github-actions[bot]'
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: checkout - name: checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: setup - name: setup node + npm cache
uses: actions/setup-node@v4 uses: actions/setup-node@v6
with: with:
node-version: "20" node-version: "20"
cache: "npm"
cache-dependency-path: ./package-lock.json
- name: requirments - name: npm ci
run: npm ci working-directory: ./scripts
run: npm ci --no-audit --no-fund
- name: setup python - name: setup python + pip cache
uses: actions/setup-python@v5 uses: actions/setup-python@v6
with: with:
python-version: "3.13" python-version: "3.13"
cache: "pip"
cache-dependency-path: ./requirements.txt
- name: install python deps - name: install python deps
run: | working-directory: ./scripts
python -m pip install --upgrade pip run: pip install -r requirements.txt
pip install pillow
- name: scripts - name: scripts
working-directory: ./scripts working-directory: ./scripts
@@ -54,31 +62,13 @@ jobs:
git commit -m "actions commit" || exit 0 git commit -m "actions commit" || exit 0
git push git push
- name: delete previous actions
uses: actions/github-script@v6
id: artifact
with:
script: |
const res = await github.rest.actions.listArtifactsForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
})
res.data.artifacts
.forEach(({ id }) => {
github.rest.actions.deleteArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: id,
})
})
- name: upload sorted - name: upload sorted
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
with: with:
name: sorted name: sorted
path: ./_sprites/sorted path: ./_sprites/sorted
retention-days: 15 retention-days: 15
compression-level: 0
- name: upload sorted-merged - name: upload sorted-merged
uses: actions/upload-artifact@v4 uses: actions/upload-artifact@v4
@@ -86,6 +76,7 @@ jobs:
name: sorted-merged name: sorted-merged
path: ./_sprites/sorted-merged path: ./_sprites/sorted-merged
retention-days: 15 retention-days: 15
compression-level: 0
- name: remove temp sorted folder - name: remove temp sorted folder
run: | run: |

23
package-lock.json generated
View File

@@ -4,23 +4,10 @@
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"dependencies": {
"adm-zip": "^0.5.16"
},
"devDependencies": { "devDependencies": {
"@types/adm-zip": "^0.5.7",
"@types/node": "^24.0.15" "@types/node": "^24.0.15"
} }
}, },
"node_modules/@types/adm-zip": {
"version": "0.5.7",
"resolved": "https://registry.npmjs.org/@types/adm-zip/-/adm-zip-0.5.7.tgz",
"integrity": "sha512-DNEs/QvmyRLurdQPChqq0Md4zGvPwHerAJYWk9l2jCbD1VPpnzRJorOdiq4zsw09NFbYnhfsoEhWtxIzXpn2yw==",
"dev": true,
"dependencies": {
"@types/node": "*"
}
},
"node_modules/@types/node": { "node_modules/@types/node": {
"version": "24.0.15", "version": "24.0.15",
"resolved": "https://registry.npmjs.org/@types/node/-/node-24.0.15.tgz", "resolved": "https://registry.npmjs.org/@types/node/-/node-24.0.15.tgz",
@@ -30,14 +17,6 @@
"undici-types": "~7.8.0" "undici-types": "~7.8.0"
} }
}, },
"node_modules/adm-zip": {
"version": "0.5.16",
"resolved": "https://registry.npmjs.org/adm-zip/-/adm-zip-0.5.16.tgz",
"integrity": "sha512-TGw5yVi4saajsSEgz25grObGHEUaDrniwvA2qwSC060KfqGPdglhvPMA2lPIoxs3PQIItj2iag35fONcQqgUaQ==",
"engines": {
"node": ">=12.0"
}
},
"node_modules/undici-types": { "node_modules/undici-types": {
"version": "7.8.0", "version": "7.8.0",
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.8.0.tgz", "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.8.0.tgz",
@@ -45,4 +24,4 @@
"dev": true "dev": true
} }
} }
} }

View File

@@ -1,10 +1,5 @@
{ {
"devDependencies": { "devDependencies": {
"@types/adm-zip": "^0.5.7",
"@types/node": "^24.0.15" "@types/node": "^24.0.15"
},
"type": "module",
"dependencies": {
"adm-zip": "^0.5.16"
} }
} }

1
requirements.txt Normal file
View File

@@ -0,0 +1 @@
pillow==11.1.0