11# #
22# @type github workflow
3- # @desc cleans up the list of deployments in the environment history
43# @author Aetherinox
54# @url https://github.com/Aetherinox
5+ # @usage cleans up the list of deployments in the environment history
6+ # edit the 'environment:' to determine which deployment to keep clean
7+ # - can be ran manually
8+ #
9+ # @secrets secrets.SELF_TOKEN self github personal access token (fine-grained)
10+ # secrets.SELF_TOKEN_CL self github personal access token (classic)
11+ # secrets.NPM_TOKEN self npmjs access token
12+ # secrets.PYPI_API_TOKEN self Pypi API token (production site) - https://pypi.org/
13+ # secrets.PYPI_API_TEST_TOKEN self Pypi API token (test site) - https://test.pypi.org/
14+ # secrets.SELF_DOCKERHUB_TOKEN self Dockerhub token
15+ # secrets.ORG_TOKEN org github personal access token (fine-grained)
16+ # secrets.ORG_TOKEN_CL org github personal access token (classic)
17+ # secrets.ORG_DOCKERHUB_TOKEN org dockerhub secret
18+ # secrets.ORG_GITEA_TOKEN org gitea personal access token (classic) with package:write permission
19+ # secrets.BOT_GPG_KEY_ASC bot gpg private key (armored) | BEGIN PGP PRIVATE KEY BLOCK
20+ # secrets.BOT_GPG_PASSPHRASE bot gpg private key passphrase
21+ # secrets.DISCORD_WEBHOOK_CHAN_GITHUB_RELEASES discord webhook to report release notifications from github to discord
22+ # secrets.DISCORD_WEBHOOK_CHAN_GITHUB_WORKFLOWS discord webhook to report workflow notifications from github to discord
23+ # secrets.DISCORD_WEBHOOK_CHAN_GITHUB_UPDATES discord webhook to report activity notifications from github to discord
24+ #
25+ #
26+ # @local these workflows can be tested locally through the use of `act`
27+ # https://github.com/nektos/act
28+ # Extract act to folder
29+ # Add system env var with path to act.exe
30+ # Run the commands:
31+ # git pull https://github.com/username/repo
32+ # act -W .github/workflows/deploy-clean.yml -P ubuntu-latest=catthehacker/ubuntu:full-22.04
33+ # act -W .github/workflows/deploy-clean.yml -s TOKEN_CL=XXXXXXXXXX --pull=false
634# #
735
8- name : " ⚙️ Deploy › Clean"
9- run-name : " ⚙️ Deploy › Clean"
36+ # #
37+
38+ name : ' 🧹 Deployments › Clean'
39+ run-name : ' 🧹 Deployments › Clean'
1040
1141# #
1242# triggers
1343# #
1444
1545on :
46+
47+ # #
48+ # Trigger > Workflow Dispatch
49+ # #
50+
1651 workflow_dispatch :
52+ inputs :
53+
54+ # #
55+ # Deployment Environment Name
56+ #
57+ # this is the name of the deployment item
58+ # #
59+
60+ DEPLOYMENT_ENV :
61+ description : ' 📦 Deployment Environment'
62+ required : true
63+ default : ' orion'
64+ type : string
65+
66+ # #
67+ # Delay
68+ #
69+ # Milliseconds to wait between cleaning up each action in history. Avoids secondary rate limit. Default: 500
70+ # #
71+
72+ DEPLOYMENT_DELAY :
73+ description : ' 🕛 Delete Delay'
74+ required : true
75+ default : ' 1000'
76+ type : string
1777
1878# #
1979# environment variables
2080# #
2181
2282env :
23- BOT_NAME_1 : AdminServ
24- BOT_NAME_2 : AdminServX
25- BOT_NAME_3 : EuropaServ
26- BOT_NAME_DEPENDABOT : dependabot[bot]
27- LABELS_JSON : |
28- [
29- { "name": "AC › Changes Made", "color": "8F1784", "description": "Requested changes have been made and are pending a re-scan" },
30- { "name": "AC › Changes Required", "color": "8F1784", "description": "Requires changes to be made to the package before being accepted" },
31- { "name": "AC › Failed", "color": "a61f2d", "description": "Autocheck failed to run through a complete cycle, requires investigation" },
32- { "name": "AC › Needs Rebase", "color": "8F1784", "description": "Due to the permissions on the requesting repo, this pull request must be rebased by the author" },
33- { "name": "AC › Passed", "color": "146b4a", "description": "Ready to be reviewed" },
34- { "name": "AC › Review Required", "color": "8F1784", "description": "PR needs to be reviewed by another person, after the requested changes have been made" },
35- { "name": "AC › Security Warning", "color": "761620", "description": "Does not conform to developer policies, or includes potentially dangerous code" },
36- { "name": "AC › Skipped Scan", "color": "8F1784", "description": "Author has skipped code scan" },
37- { "name": "Status 𐄂 Duplicate", "color": "75536b", "description": "Issue or pull request already exists" },
38- { "name": "Status 𐄂 Accepted", "color": "2e7539", "description": "This pull request has been accepted" },
39- { "name": "Status 𐄂 Autoclosed", "color": "3E0915", "description": "Originally stale and was autoclosed for no activity" },
40- { "name": "Status 𐄂 Denied", "color": "ba4058", "description": "Pull request has been denied" },
41- { "name": "Status 𐄂 Locked", "color": "550F45", "description": "Automatically locked by AdminServ for a prolonged period of inactivity" },
42- { "name": "Status 𐄂 Need Info", "color": "2E3C4C", "description": "Not enough information to resolve" },
43- { "name": "Status 𐄂 No Action", "color": "030406", "description": "Closed without any action being taken" },
44- { "name": "Status 𐄂 Pending", "color": "984b12", "description": "Pending pull request" },
45- { "name": "Status 𐄂 Released", "color": "1b6626", "description": "Issues or PR has been implemented and is now live" },
46- { "name": "Status 𐄂 Reopened", "color": "8a6f14", "description": "A previously closed PR which has been re-opened" },
47- { "name": "Status 𐄂 Review", "color": "9e1451", "description": "Currently pending review" },
48- { "name": "Status 𐄂 Stale", "color": "928282", "description": "Has not had any activity in over 30 days" },
49- { "name": "Type ◦ Bug", "color": "9a2c2c", "description": "Something isn't working" },
50- { "name": "Type ◦ Dependency", "color": "243759", "description": "Item is associated to dependency" },
51- { "name": "Type ◦ Docs", "color": "0e588d", "description": "Improvements or modifications to docs" },
52- { "name": "Type ◦ Feature", "color": "3c4e93", "description": "Feature request" },
53- { "name": "Type ◦ Git Action", "color": "030406", "description": "GitHub Action / workflow" },
54- { "name": "Type ◦ Pull Request", "color": "8F1784", "description": "Normal pull request" },
55- { "name": "Type ◦ Roadmap", "color": "8F1784", "description": "Feature or bug currently planned for implementation" },
56- { "name": "Type ◦ Internal", "color": "A51994", "description": "Assigned items are for internal developer use" },
57- { "name": "Build ◦ Desktop", "color": "c7ca4a", "description": "Specific to desktop" },
58- { "name": "Build ◦ Linux", "color": "c7ca4a", "description": "Specific to Linux" },
59- { "name": "Build ◦ MacOS", "color": "c7ca4a", "description": "Specific to MacOS" },
60- { "name": "Build ◦ Mobile", "color": "c7ca4a", "description": "Specific to mobile" },
61- { "name": "Build ◦ Web", "color": "c7ca4a", "description": "Specific to web" },
62- { "name": "Build ◦ Windows", "color": "c7ca4a", "description": "Specific to Windows" },
63- { "name": "› API", "color": "F99B50", "description": "Plugin API, CLI, browser JS API" },
64- { "name": "› Auto-type", "color": "9141E0", "description": "Auto-type functionality in desktop apps" },
65- { "name": "› Browser", "color": "9141E0", "description": "Browser plugins and passing data to <=> from app" },
66- { "name": "› Customization", "color": "E3F0FC", "description": "Customizations: plugins, themes, configs" },
67- { "name": "› Design", "color": "FA70DE", "description": "Design related queries" },
68- { "name": "› Dist", "color": "FA70DE", "description": "Installers and other forms of software distribution" },
69- { "name": "› Enterprise", "color": "11447a", "description": "Issues about collaboration, administration, and so on" },
70- { "name": "› Hardware", "color": "5a7503", "description": "YubiKey, other tokens, biometrics" },
71- { "name": "› Import/Export", "color": "F5FFCC", "description": "Import from and export to different file formats" },
72- { "name": "› Improvement", "color": "185c98", "description": "Enhance an existing feature" },
73- { "name": "› Performance", "color": "006b75", "description": "Web and desktop performance issues" },
74- { "name": "› Plugin Request", "color": "FCE9CA", "description": "Requested changes should be implemented as a plugin" },
75- { "name": "› Security", "color": "F75D39", "description": "Security issues" },
76- { "name": "› Self-Hosting", "color": "fad8c7", "description": "Self-hosting installations and configs" },
77- { "name": "› Storage", "color": "5319e7", "description": "Storage providers: Dropbox, Google, WebDAV, etc." },
78- { "name": "› Updater", "color": "1BADDE", "description": "Auto-updater issues" },
79- { "name": "› UX", "color": "1BADDE", "description": "UX and usability" },
80- { "name": "› Website", "color": "fef2c0", "description": "Website related issues" },
81- { "name": "⚠ Urgent", "color": "a8740e", "description": "Requires urgent attention" },
82- { "name": "⚠ Announcement", "color": "DB4712", "description": "Announcements" },
83- { "name": "📰 Progress Report", "color": "392297", "description": "Development updates" },
84- { "name": "📦 Release", "color": "277542", "description": "Release announcements" },
85- { "name": "✔️ Poll", "color": "972255", "description": "Community polls" },
86- { "name": "❔ Question", "color": "FFFFFF", "description": "All questions" }
87- ]
83+ DEPLOYMENT_ENV : ${{ github.event.inputs.DEPLOYMENT_ENV || 'orion' }}
84+ DEPLOYMENT_DELAY : ${{ github.event.inputs.DEPLOYMENT_DELAY || '1000' }}
85+ BOT_NAME_1 : EuropaServ
86+ BOT_NAME_2 : BinaryServ
87+ BOT_NAME_DEPENDABOT : dependabot[bot]
88+ BOT_NAME_RENOVATE : renovate[bot]
8889
8990# #
9091# jobs
9192# #
9293
9394jobs :
9495 cleanup :
96+ name : >-
97+ 🧹 Deployments › Clean
9598 runs-on : ubuntu-latest
99+ # runs-on: apollo-x64
100+ timeout-minutes : 5
96101 permissions : write-all
97-
102+
98103 steps :
104+
105+ # #
106+ # Cleanup › Set Env Variables
107+ # #
108+
109+ - name : >-
110+ 🕛 Get Timestamp
111+ id: task_cleanup_set_timestamp
112+ run: |
113+ echo "YEAR=$(date +'%Y')" >> $GITHUB_ENV
114+ echo "NOW=$(date +'%m-%d-%Y %H:%M:%S')" >> $GITHUB_ENV
115+ echo "NOW_SHORT=$(date +'%m-%d-%Y')" >> $GITHUB_ENV
116+ echo "NOW_LONG=$(date +'%m-%d-%Y %H:%M')" >> $GITHUB_ENV
117+ echo "NOW_DOCKER_LABEL=$(date +'%Y%m%d')" >> $GITHUB_ENV
118+
119+ # #
120+ # Release › Github › Checkout › Arm64
121+ # #
122+
123+ - name : >-
124+ ✅ Checkout
125+ id: task_cleanup_gh_checkout
126+ uses: actions/checkout@v4
127+ with:
128+ fetch-depth: 0
129+
130+ # #
131+ # Cleanup › Start
132+ # #
133+
99134 - name : >-
100135 ⚙️ Deployments › Clean
136+ id: task_cleanup_start
101137 uses: Aetherinox/delete-deploy-env-action@v3
102138 with:
103139 token: ${{ secrets.SELF_TOKEN_CL }}
104- environment: orion
140+ environment: '${{ env.DEPLOYMENT_ENV }}'
105141 onlyRemoveDeployments: true
106- delay: "1000"
142+ delay: "${{ env.DEPLOYMENT_DELAY }}"
143+
144+ # #
145+ # Cleanup › Get Weekly Commits
146+ # #
147+
148+ - name : >-
149+ 🕛 Get Weekly Commit List
150+ id: task_cleanup_set_weekly_commit_list
151+ run: |
152+ echo 'WEEKLY_COMMITS<<EOF' >> $GITHUB_ENV
153+ git log --format="[\`%h\`](${{ github.server_url }}/${{ github.repository }}/commit/%H) %s - %an" --since=7.days >> $GITHUB_ENV
154+ echo 'EOF' >> $GITHUB_ENV
155+
0 commit comments