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/**"
- "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: |