Skip to content

Commit

Permalink
Merge pull request #34 from gridhead/wipe
Browse files Browse the repository at this point in the history
Manage stored artifacts before building more
  • Loading branch information
gridhead authored Sep 2, 2024
2 parents 8251987 + 8674a00 commit 1072048
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 3 deletions.
12 changes: 9 additions & 3 deletions .github/workflows/mswn.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ jobs:
run: python3 -m poetry install

- name: Build the project binary for Expedite Bridge
run: pyinstaller expedite/client/bridge/main.py --clean --onefile --name ed-bridge-$("${{ github.sha }}".SubString(0, 8)) --windowed --icon assets/icon/expedite.ico
run: pyinstaller expedite/client/bridge/main.py --clean --onefile --name ed-bridge-$("$env:GITHUB_HASH".SubString(0, 8)) --windowed --icon assets/icon/expedite.ico
env:
GITHUB_HASH: ${{ github.sha }}

- name: Upload the project binaries for Expedite Bridge
uses: actions/upload-artifact@v4
Expand All @@ -38,7 +40,9 @@ jobs:
overwrite: true

- name: Build the project binary for Expedite Prompt
run: pyinstaller expedite/client/prompt/main.py --clean --onefile --name ed-prompt-$("${{ github.sha }}".SubString(0, 8)) --icon assets/icon/expedite.ico
run: pyinstaller expedite/client/prompt/main.py --clean --onefile --name ed-prompt-$("$env:GITHUB_HASH".SubString(0, 8)) --icon assets/icon/expedite.ico
env:
GITHUB_HASH: ${{ github.sha }}

- name: Upload the project binaries for Expedite Prompt
uses: actions/upload-artifact@v4
Expand All @@ -50,7 +54,9 @@ jobs:
overwrite: true

- name: Build the project binary for Expedite Server
run: pyinstaller expedite/server/main.py --clean --onefile --name ed-server-$("${{ github.sha }}".SubString(0, 8)) --icon assets/icon/expedite.ico
run: pyinstaller expedite/server/main.py --clean --onefile --name ed-server-$("$env:GITHUB_HASH".SubString(0, 8)) --icon assets/icon/expedite.ico
env:
GITHUB_HASH: ${{ github.sha }}

- name: Upload the project binaries for Expedite Server
uses: actions/upload-artifact@v4
Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/wipe.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
name: Manage artifacts to retain four recent artifacts
on: [push]
jobs:
ci-wipe:
runs-on: ubuntu-latest
steps:
- name: Manage artifacts to retain four recent artifacts
run: |
KEEP_QANT=4
ARTIFACT_UNIT=$(gh api repos/gridhead/expedite/actions/artifacts --paginate --jq '.artifacts | sort_by(.created_at) | .[].id')
ARTIFACT_LIST=($ARTIFACT_UNIT)
WIPE_QANT=$((${#ARTIFACT_LIST[@]} - $KEEP_QANT))
if [ $WIPE_QANT -gt 0 ]; then
for item in $(seq 0 $(($WIPE_QANT - 1))); do
ARTIFACT_ID=${ARTIFACT_LIST[$item]}
echo "Deleting artifact ID $ARTIFACT_ID..."
gh api repos/gridhead/expedite/actions/artifacts/$ARTIFACT_ID -X DELETE
done
else
echo "No artifacts available."
fi
env:
GITHUB_TOKEN: ${{ secrets.GHBTOKEN }}

0 comments on commit 1072048

Please sign in to comment.