From f516b4a2afb2f98d7ccbbb2413639067f2cec5e9 Mon Sep 17 00:00:00 2001 From: snus xD Date: Wed, 24 Dec 2025 10:53:43 +0300 Subject: [PATCH] refactor: optimized workflow --- .github/workflows/main.yml | 49 ++++++++++++++++---------------------- package-lock.json | 23 +----------------- package.json | 5 ---- requirements.txt | 1 + 4 files changed, 22 insertions(+), 56 deletions(-) create mode 100644 requirements.txt diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 92f8813..4f85499 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -6,35 +6,43 @@ on: - "_sprites/**" - "scripts/**" +concurrency: + group: sorting-${{ github.ref }} + cancel-in-progress: true + permissions: contents: write - actions: write jobs: run-scripts: + if: github.actor != 'github-actions[bot]' runs-on: ubuntu-latest steps: - name: checkout uses: actions/checkout@v4 - - name: setup - uses: actions/setup-node@v4 + - name: setup node + npm cache + uses: actions/setup-node@v6 with: node-version: "20" + cache: "npm" + cache-dependency-path: ./package-lock.json - - name: requirments - run: npm ci + - name: npm ci + working-directory: ./scripts + run: npm ci --no-audit --no-fund - - name: setup python - uses: actions/setup-python@v5 + - name: setup python + pip cache + uses: actions/setup-python@v6 with: python-version: "3.13" + cache: "pip" + cache-dependency-path: ./requirements.txt - name: install python deps - run: | - python -m pip install --upgrade pip - pip install pillow + working-directory: ./scripts + run: pip install -r requirements.txt - name: scripts working-directory: ./scripts @@ -54,31 +62,13 @@ jobs: git commit -m "actions commit" || exit 0 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 uses: actions/upload-artifact@v4 with: name: sorted path: ./_sprites/sorted retention-days: 15 + compression-level: 0 - name: upload sorted-merged uses: actions/upload-artifact@v4 @@ -86,6 +76,7 @@ jobs: name: sorted-merged path: ./_sprites/sorted-merged retention-days: 15 + compression-level: 0 - name: remove temp sorted folder run: | diff --git a/package-lock.json b/package-lock.json index 2522021..e5ad5a4 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4,23 +4,10 @@ "requires": true, "packages": { "": { - "dependencies": { - "adm-zip": "^0.5.16" - }, "devDependencies": { - "@types/adm-zip": "^0.5.7", "@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": { "version": "24.0.15", "resolved": "https://registry.npmjs.org/@types/node/-/node-24.0.15.tgz", @@ -30,14 +17,6 @@ "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": { "version": "7.8.0", "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.8.0.tgz", @@ -45,4 +24,4 @@ "dev": true } } -} +} \ No newline at end of file diff --git a/package.json b/package.json index 202e813..21c52f9 100644 --- a/package.json +++ b/package.json @@ -1,10 +1,5 @@ { "devDependencies": { - "@types/adm-zip": "^0.5.7", "@types/node": "^24.0.15" - }, - "type": "module", - "dependencies": { - "adm-zip": "^0.5.16" } } \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..99f45ec --- /dev/null +++ b/requirements.txt @@ -0,0 +1 @@ +pillow==11.1.0 \ No newline at end of file