-
-
Notifications
You must be signed in to change notification settings - Fork 3
748 lines (641 loc) · 30.7 KB
/
worker-publish.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
# #
# @parent github workflow
# @desc publish release to github
# version of release fetched from /src/package.json.
# ensure `cloudflare/wrangler-action@v3` worker uses env variable "production"
# @author Aetherinox
# @url https://github.com/Aetherinox
# #
run-name: "🌑 Cloudflare Worker › Release"
name: "☁️ Worker › Release"
# #
# triggers
# #
on:
workflow_dispatch:
inputs:
# #
# Name of the plugin to use when creating the release zip filename
# e.g: searxico-cf-worker-v1.0.0.zip
# #
PLUGIN_NAME:
description: "📦 Name of App"
required: true
default: 'searxico'
type: string
# #
# ENABLE: the changelog generated in releases tab will only display single commits.
# DISABLE: the changelog shows pull requests completed based on their labels
# #
CHANGELOG_MODE_COMMIT:
description: "📑 Use Commits Instead of PRs"
required: true
default: true
type: boolean
# #
# ENABLE: Will show all types of commits, including uncategorized
# DISABLE: WIll only show actions that have been categorized using the format
# type(scope): description
# type: description
# #
SHOW_UNCATEGORIZED:
description: "🗂️ Show Uncategorized Commits"
required: true
default: false
type: boolean
# #
# ENABLE: released version will be marked as pre-release
# DISABLE: release version will be marked as stable / normal release
# #
PRERELEASE:
description: "🧪 Build RC (Pre-release)"
required: true
default: false
type: boolean
# #
# Release Candidate version number
# this will be added to the end of your released app in the releases page.
# e.g: searxico-cf-worker-v1.0.0-rc.1
# #
VERSION_RC:
description: "🧪 RC (Pre-release) Ver (searxico-cf-worker-rc.v1)"
required: false
type: string
default: "1"
# #
# environment variables
# #
env:
PLUGIN_NAME: ${{ github.event.inputs.PLUGIN_NAME || 'searxico' }}
CHANGELOG_MODE_COMMIT: true
SHOW_UNCATEGORIZED: false
PRERELEASE: false
VERSION_RC: '1'
WORKER_ID: 'favicon'
FOLDER_DIST: 'dist'
BOT_NAME_1: AdminServ
BOT_NAME_2: AdminServX
BOT_NAME_3: EuropaServ
BOT_NAME_DEPENDABOT: dependabot[bot]
# #
# jobs
# #
jobs:
# #
# JOB > INITIALIZE
# #
job-initialize:
name: >-
📦 Initialize
runs-on: ubuntu-latest
outputs:
package_version: ${{ steps.task_initialize_package_version.outputs.PACKAGE_VERSION }}
permissions:
contents: write
packages: write
environment:
name: Orion
steps:
# #
# Job > Initialize > Start
# #
- name: "✅ Start"
id: task_initialize_start
run: |
echo "Starting build"
# #
# Job > Initialize > Checkout
# #
- name: "☑️ Checkout"
id: task_initialize_checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
# #
# Package Version > Set
# Get version from package.json VERSION value
# #
- name: "👁️🗨️ Package Version › Get"
id: task_initialize_package_version
run: |
VER=$(cat src/package.json | jq -r '.version')
echo "PACKAGE_VERSION=$VER" >> $GITHUB_OUTPUT
# #
# Package Version > Print (Debug)
# #
- name: "👁️🗨️ Package Version › Print"
id: task_initialize_package_version_debug
run: |
echo "VERSION: ${{ steps.task_initialize_package_version.outputs.PACKAGE_VERSION }}"
# #
# Job > Release > Cloudflare
# #
job-cloudflare:
name: >-
☁️ Cloudflare Worker
needs: job-initialize
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
outputs:
cf_deploy_url: ${{ steps.task_cloudflare_deploy.outputs.deployment-url }}
environment:
name: Orion
steps:
# #
# Cloudflare Worker > Checkout
# #
- name: "☑️ Checkout"
id: task_cloudflare_checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
# #
# Cloudflare Worker > Setup Node
# #
- name: "⚙️ Setup › Node"
id: task_cloudflare_node_setup
uses: actions/setup-node@v4
with:
node-version: '20.x'
registry-url: https://npm.pkg.github.com/
scope: '@aetherinox'
# #
# Cloudflare Worker > Install Node
# #
- name: "📦 NPM › Install"
id: task_cloudflare_npm_install
run: |
npm install
env:
NODE_AUTH_TOKEN: ${{ secrets.SELF_TOKEN_CL }}
# #
# Cloudflare Worker > Run Prettier
# #
- name: "🪪 NPM › Pretty"
id: task_cloudflare_npm_prettylint
run: |
npm run pretty
# #
# Cloudflare Worker > Debug > Print pacakge Version
# #
- name: "☁️ Cloudflare › Version"
id: task_cloudflare_version
run: |
echo "VERSION: ${{ env.PACKAGE_VERSION }}"
# #
# Cloudflare Worker > Deploy
#
# ensure `environment` is set to production. options available:
# - production
# - dev
# #
- name: "☁️ Cloudflare › Deploy"
id: task_cloudflare_deploy
uses: cloudflare/wrangler-action@v3
with:
apiToken: ${{ secrets.CF_TOKEN }}
accountId: ${{ secrets.CF_ACCOUNT_ID }}
workingDirectory: "src"
environment: 'production'
command: deploy --minify
# #
# Cloudflare Worker > Deployment › Output
#
# returns the deployment url
# #
- name: "☁️ Cloudflare › Deployment Output"
id: task_cloudflare_deploy_output
env:
DEPLOYMENT_URL: ${{ steps.task_cloudflare_deploy.outputs.deployment-url }}
run: echo $DEPLOYMENT_URL
# #
# Job > Release > Github
# #
job-release:
name: >-
📦 Publish › Release
runs-on: ubuntu-latest
needs: [ job-initialize, job-cloudflare ]
env:
PACKAGE_VERSION: ${{ needs.job-initialize.outputs.package_version }}
outputs:
guid: ${{ steps.task_release_dotenv_get.outputs.GUID }}
uuid: ${{ steps.task_release_dotenv_get.outputs.UUID }}
permissions:
contents: write
packages: write
environment:
name: Orion
steps:
# #
# Release > Checkout
# #
- name: "☑️ Checkout"
id: task_release_checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
# #
# Release > Print Version Debug
# #
- name: "🪪 Test Next Job Version"
id: task_release_debug_print_ver
run: |
echo "VERSION: ${{ env.PACKAGE_VERSION }}"
# #
# Release > Install package via NPM
# #
- name: "🪪 NPM › Install"
id: task_release_npm_install
run: |
npm install
env:
NODE_AUTH_TOKEN: ${{ secrets.SELF_TOKEN_CL }}
# #
# Release > Print / Lint
# #
- name: "🪪 NPM › Pretty"
id: task_release_npm_prettylint
run: |
npm run pretty
# #
# Release > Execute npm generate so that a uuid and guid can be created
# #
- name: "🪪 Generate IDs"
id: task_release_npm_env_generate
run: |
npm run root:generate
# #
# .ENV > Get
# Get guid and uuid from env variable generated by npm
# #
- name: "🪪 .ENV › Get"
id: task_release_dotenv_get
uses: falti/dotenv-action@v1
# #
# .ENV > Print (Debug)
# Show guid and uuid from env variable generated by npm
# #
- name: "🪪 .ENV › Read"
id: task_dotenv_debug_print
run: |
echo "GUID: ${{ steps.task_release_dotenv_get.outputs.GUID }}"
echo "UUID: ${{ steps.task_release_dotenv_get.outputs.UUID }}"
# #
# Build Project & Create Zip
# #
- name: "🔨 Build › Stable ( ${{ inputs.PLUGIN_NAME }}-${{ env.PACKAGE_VERSION }}.zip )"
id: task_release_build_st
if: ${{ startsWith( inputs.PRERELEASE, false ) }}
run: |
echo Building STABLE Package .zip ${{ env.PACKAGE_VERSION }}
zip -r ${{ inputs.PLUGIN_NAME }}-${{ env.PACKAGE_VERSION }}.zip package.json wrangler.toml .prettierrc README.md LICENSE src -x src/tests/**\*
ls
env:
NODE_AUTH_TOKEN: ${{ secrets.ADMINSERV_TOKEN_CL }}
- name: "🔨 Build › RC ( ${{ inputs.PLUGIN_NAME }}-${{ env.PACKAGE_VERSION }}-rc.${{ inputs.VERSION_RC }}.zip )"
id: task_release_build_rc
if: ${{ startsWith( inputs.PRERELEASE, true ) }}
run: |
echo Building PRE-RELEASE Package .zip ${{ env.PACKAGE_VERSION }}
zip -r ${{ inputs.PLUGIN_NAME }}-${{ env.PACKAGE_VERSION }}-rc.${{ inputs.VERSION_RC }}.zip package.json wrangler.toml .prettierrc README.md LICENSE src -x src/tests/**\*
ls
env:
NODE_AUTH_TOKEN: ${{ secrets.ADMINSERV_TOKEN_CL }}
# #
# [ Tag ]: Pre Create
#
# in order to use the changelog github action, you must pre-create the tag otherwise
# the changelog action will have no idea what tag you are going to be creating and
# the list of commits will not be for the correct release.
# #
- name: "🔖 Tag › Pre Create ${{ env.PACKAGE_VERSION }}"
id: task_release_tag_create
uses: rickstaa/action-create-tag@v1
with:
tag: ${{ env.PACKAGE_VERSION }}
tag_exists_error: false
message: "Latest release"
gpg_private_key: ${{ secrets.ADMINSERV_GPG_KEY_ASC }}
gpg_passphrase: ${{ secrets.ADMINSERV_GPG_PASSPHRASE }}
# #
# [ Tag ]: Confirm
#
# check if tag already exists
# #
- name: "🔖 Tag › Confirm ${{ env.PACKAGE_VERSION }}"
id: task_release_tag_get
run: |
echo "Tag already present: ${{ env.TAG_EXISTS }}"
echo "Tag already present: ${{ steps.task_release_tag_create.outputs.tag_exists }}"
# #
# Checksum > Generate
# #
- name: "🆔 Checksum › Stable"
id: task_release_checksum_st_set
if: ${{ startsWith( inputs.PRERELEASE, false ) }}
run: |
filename_zip="${{ inputs.PLUGIN_NAME }}-${{ env.PACKAGE_VERSION }}.zip"
sha256="$(shasum --algorithm 256 ${filename_zip} | awk '{ print $1 }')"
shasum --algorithm 256 ${filename_zip} > SHA256SUMS.txt
echo "FILE_ZIP=${filename_zip}" >> $GITHUB_ENV
echo "SHA256SUM=${sha256}" >> $GITHUB_ENV
- name: "🆔 Checksum › RC"
id: task_release_checksum_rc_set
if: ${{ startsWith( inputs.PRERELEASE, true ) }}
run: |
filename_zip="${{ inputs.PLUGIN_NAME }}-${{ env.PACKAGE_VERSION }}-rc.${{ inputs.VERSION_RC }}.zip"
sha256="$(shasum --algorithm 256 ${filename_zip} | awk '{ print $1 }')"
shasum --algorithm 256 ${filename_zip} > SHA256SUMS.txt
echo "FILE_ZIP=${filename_zip}" >> $GITHUB_ENV
echo "SHA256SUM=${sha256}" >> $GITHUB_ENV
# #
# Checksum > Print
# #
- name: "🆔 Checksum › Print"
id: task_release_checksum_st_get
run: |
echo ${{ env.SHA256SUM }}
# #
# Contributor Images
# #
- name: "🥸 Contributors › Generate"
id: task_release_contribs_generate
uses: jaywcjlove/github-action-contributors@main
with:
filter-author: (renovate\[bot\]|renovate-bot|dependabot\[bot\])
output: CONTRIBUTORS.svg
avatarSize: 42
# #
# Checksum > Add to ZIP file
# #
- name: "📦 Zip › Add Checksum › Stable"
id: task_release_zip_st
if: ${{ startsWith( inputs.PRERELEASE, false ) }}
run: |
echo Zipping STABLE Package .zip ${{ inputs.PLUGIN_NAME }}-${{ env.PACKAGE_VERSION }}.zip
zip -jr ${{ inputs.PLUGIN_NAME }}-${{ env.PACKAGE_VERSION }}.zip SHA256SUMS.txt
ls
- name: "📦 Zip › Add Checksum › RC"
id: task_release_zip_rc
if: ${{ startsWith( inputs.PRERELEASE, true ) }}
run: |
echo Zipping PRE-RELEASE Package .zip ${{ inputs.PLUGIN_NAME }}-${{ env.PACKAGE_VERSION }}-rc.${{ inputs.VERSION_RC }}.zip
zip -jr ${{ inputs.PLUGIN_NAME }}-${{ env.PACKAGE_VERSION }}-rc.${{ inputs.VERSION_RC }}.zip SHA256SUMS.txt
ls
# #
# Changelog > Generate
#
# generates a changelog from the github api. requires a PREVIOUS_TAG in order to figure
# out the changes made between the two versions.
#
# outputs:
# ${{ steps.changelog.outputs.changelog }}
# #
- name: "📝 Changelog › Pre Setup (Categorized Commits)"
id: task_release_changelog_categorized_sha_set
run: |
echo "TAG_LAST=$(git describe --tags --abbrev=0)" >> $GITHUB_ENV
echo "COMMIT_LAST=$(git rev-parse HEAD)" >> $GITHUB_ENV
- name: "📝 Changelog › Build (Categorized)"
id: task_release_changelog_categorized
if: ${{ startsWith( inputs.SHOW_UNCATEGORIZED, false ) }}
uses: mikepenz/release-changelog-builder-action@v5
with:
token: ${{ secrets.ADMINSERV_TOKEN }}
#fromTag: "${{ env.TAG_LAST }}"
#toTag: "${{ github.ref }}"
configuration: ".github/changelog-configuration.json"
ignorePreReleases: false
commitMode: ${{ inputs.CHANGELOG_MODE_COMMIT }}
fetchReleaseInformation: true
fetchViaCommits: true
configurationJson: |
{
"template": "## Release Info \n| Item | Value |\n| --- | --- |\n|<sub>📄 ${{ env.FILE_ZIP }}</sub>|<sub>Contains the latest version of the favicon cloudflare worker</sub>|\n|<sub>🏷️ SHA256</sub>|<sub>`${{ env.SHA256SUM }}`</sub>|\n|<sub>🏷️ GUID</sub>|<sub>`${{ steps.task_release_dotenv_get.outputs.GUID }}`</sub>|\n|<sub>🏷️ GUID</sub>|<sub>`${{ steps.task_release_dotenv_get.outputs.GUID }}`</sub>|\n|<sub>🕟 Stamp</sub>|<sub>`#{{FROM_TAG}}-#{{FROM_TAG_DATE}} 🔺 #{{TO_TAG}}-#{{TO_TAG_DATE}}`</sub>|\n|<sub>📅 Last Release</sub>|<sub>`#{{DAYS_SINCE}} days ago`</sub>|\n\n<br>\n\n---\n\n<br>\n\n### What's New\nThis release contains the following changes:\n\n<br>\n\n---\n\n<br>\n\n### Statistics\nHow the files have changed:\n<ul><li><a href='#{{RELEASE_DIFF}}'>Changed files</a> : <b>#{{CHANGED_FILES}}</b> </li><li>Changes : <b>#{{CHANGES}}</b> </li><li>Commits : <b>#{{COMMITS}}</b> </li><li>Additions : <b>#{{ADDITIONS}}</b></li><li>Deletions : <b>#{{DELETIONS}}</b></li><li>PRs (categorized) : <b>#{{CATEGORIZED_COUNT}}</b></li><li>PRs (uncategorized) : <b>#{{UNCATEGORIZED_COUNT}}</b></li><li>PRs (open) : <b>#{{OPEN_COUNT}}</b></li>\n<br />\n</ul>\n\n<br>\n\n---\n\n<br>\n\n### Pull Requests\nThis release is associated with the following pull requests:\n#{{CHANGELOG}}\n\n<br>\n\n---\n\n<br>\n\n"
}
env:
GITHUB_TOKEN: ${{ secrets.ADMINSERV_TOKEN }}
# #
# shows only categorized commits using the commit standards
# type(scope): description
# type: description
# #
- name: "📝 Changelog › Build (Uncategorized)"
id: task_release_changelog_uncategorized
if: ${{ startsWith( inputs.SHOW_UNCATEGORIZED, true ) }}
uses: mikepenz/release-changelog-builder-action@v5
with:
token: ${{ secrets.ADMINSERV_TOKEN }}
#fromTag: "${{ env.TAG_LAST }}"
#toTag: "${{ github.ref }}"
configuration: ".github/changelog-configuration.json"
ignorePreReleases: false
commitMode: ${{ inputs.CHANGELOG_MODE_COMMIT }}
fetchReleaseInformation: true
fetchViaCommits: true
configurationJson: |
{
"template": "## Release Info \n| Item | Value |\n| --- | --- |\n|<sub>📄 ${{ env.FILE_ZIP }}</sub>|<sub>Contains the latest version of the favicon cloudflare worker</sub>|\n|<sub>🏷️ SHA256</sub>|<sub>`${{ env.SHA256SUM }}`</sub>|\n|<sub>🏷️ GUID</sub>|<sub>`${{ steps.task_release_dotenv_get.outputs.GUID }}`</sub>|\n|<sub>🏷️ GUID</sub>|<sub>`${{ steps.task_release_dotenv_get.outputs.GUID }}`</sub>|\n|<sub>🕟 Stamp</sub>|<sub>`#{{FROM_TAG}}-#{{FROM_TAG_DATE}} 🔺 #{{TO_TAG}}-#{{TO_TAG_DATE}}`</sub>|\n|<sub>📅 Last Release</sub>|<sub>`#{{DAYS_SINCE}} days ago`</sub>|\n\n<br>\n\n---\n\n<br>\n\n### What's New\nThis release contains the following changes:\n\n<br>\n\n---\n\n<br>\n\n### Statistics\nHow the files have changed:\n<ul><li><a href='#{{RELEASE_DIFF}}'>Changed files</a> : <b>#{{CHANGED_FILES}}</b> </li><li>Changes : <b>#{{CHANGES}}</b> </li><li>Commits : <b>#{{COMMITS}}</b> </li><li>Additions : <b>#{{ADDITIONS}}</b></li><li>Deletions : <b>#{{DELETIONS}}</b></li><li>PRs (categorized) : <b>#{{CATEGORIZED_COUNT}}</b></li><li>PRs (uncategorized) : <b>#{{UNCATEGORIZED_COUNT}}</b></li><li>PRs (open) : <b>#{{OPEN_COUNT}}</b></li>\n<br />\n</ul>\n\n<br>\n\n---\n\n<br>\n\n### Commits (#{{UNCATEGORIZED_COUNT}})\nThe following commits are uncategorized:\n#{{UNCATEGORIZED}}\n\n<br>\n\n---\n\n<br>\n\n### Pull Requests\nThis release is associated with the following pull requests:\n#{{CHANGELOG}}\n\n<br>\n\n"
}
env:
GITHUB_TOKEN: ${{ secrets.ADMINSERV_TOKEN }}
# #
# Changelog > Fetch
# #
- name: "📝 Changelog › Print (Categorized)"
if: ${{ startsWith( inputs.SHOW_UNCATEGORIZED, false ) }}
run: |
echo "${{ steps.task_release_changelog_categorized.outputs.changelog }}"
- name: "📝 Changelog › Print (Uncategorized)"
if: ${{ startsWith( inputs.SHOW_UNCATEGORIZED, true ) }}
run: |
echo "${{ steps.task_release_changelog_uncategorized.outputs.changelog }}"
# #
# [ Release ]: Post Release
#
# outputs:
# [RELEASE ID]:
# ${{ steps.task_release_bundle_rc.outputs.id
# ${{ steps.task_release_bundle_st.outputs.id
# #
- name: "🏳️ Post › Stable"
if: ${{ startsWith( inputs.PRERELEASE, false ) }}
uses: softprops/action-gh-release@v2
id: task_release_bundle_st
env:
GITHUB_TOKEN: ${{ secrets.ADMINSERV_TOKEN_CL }}
with:
token: ${{ secrets.ADMINSERV_TOKEN_CL }}
name: v${{ env.PACKAGE_VERSION }}
tag_name: ${{ env.PACKAGE_VERSION }}
target_commitish: ${{ github.event.inputs.branch }}
draft: false
generate_release_notes: false
files: |
${{ inputs.PLUGIN_NAME }}-${{ env.PACKAGE_VERSION }}.zip
SHA256SUMS.txt
prerelease: false
body: |
${{ steps.task_release_changelog_categorized.outputs.changelog }}
${{ steps.task_release_changelog_uncategorized.outputs.changelog }}
- name: "🏳️ Post › Release Candidate"
if: ${{ startsWith( inputs.PRERELEASE, true ) }}
uses: softprops/action-gh-release@v2
id: task_release_bundle_rc
env:
GITHUB_TOKEN: ${{ secrets.ADMINSERV_TOKEN }}
with:
token: ${{ secrets.ADMINSERV_TOKEN }}
name: v${{ env.PACKAGE_VERSION }}
tag_name: ${{ env.PACKAGE_VERSION }}
target_commitish: ${{ github.event.inputs.branch }}
draft: false
generate_release_notes: false
files: |
${{ inputs.PLUGIN_NAME }}-${{ env.PACKAGE_VERSION }}-rc.${{ inputs.VERSION_RC }}.zip
SHA256SUMS.txt
prerelease: false
body: |
> [!WARNING]
> This is a **release candidate**, which means it is not a stable release and could contain bugs. You should download it at your own risk.
${{ steps.task_release_changelog_categorized.outputs.changelog }}
${{ steps.task_release_changelog_uncategorized.outputs.changelog }}
# #
# Print Status
# #
- name: "🎛️ Status › Print"
id: task_release_status_print
run: |
echo "Printing Variables"
echo
echo "---- CHANGELOG ---------------------------------------------------------------"
echo "${{ steps.task_release_changelog_categorized.outputs.changelog }}"
echo "${{ steps.task_changelog_uncategorized.outputs.changelog }}"
echo "---- CHANGELOG ---------------------------------------------------------------"
echo ""
echo ""
echo "---- VARIABLES ---------------------------------------------------------------"
echo "Package Version ............ ${{ env.PACKAGE_VERSION }}"
echo "Tag: Previous .............. ${{ env.TAG_LAST }}"
echo "Tag: Now.... ............... ${{ github.ref }}"
echo "Last Commit ................ ${{ env.COMMIT_LAST }}"
echo "ST Output ID ............... ${{ steps.task_release_bundle_st.outputs.id }}"
echo "RC Output ID ............... ${{ steps.task_release_bundle_rc.outputs.id }}"
echo "---- CHANGELOG ---------------------------------------------------------------"
# #
# Upload artifacts > .deb packages
# #
- name: >-
📋 Upload Artifacts › ${{ inputs.PLUGIN_NAME }}-${{ env.PACKAGE_VERSION }}.zip
id: task_release_artifact
uses: actions/upload-artifact@v4
if: always()
with:
name: "release"
path: ${{ inputs.PLUGIN_NAME }}-${{ env.PACKAGE_VERSION }}.zip
retention-days: 30
# #
# JOB > COMPLETE
# #
job-complete:
name: >-
🆗 Successful Deployment
runs-on: ubuntu-latest
environment:
name: Orion
steps:
# #
# Job > Complete > Download Artifacts
# #
- name: "📁 Download › Saved Artifacts"
id: task_complete_artifacts_download
uses: actions/download-artifact@v4
# #
# Job > Complete > Get publish timestamp
# #
- name: "🕛 Get Timestamp"
id: task_complete_timestamp_get
run: |
echo "NOW=$(date +'%m-%d-%Y %H:%M:%S')" >> $GITHUB_ENV
# #
# Job > Complete > Cloudflare > Check Project
# this step checks to see if your project already exists on cloudflare
# today date --utc +%FT%TZ
# yesterday date --utc -d '-1 day' '+%FT%TZ'
#
# Endpoint `/workers/scripts/` requires Cloudflare API permission:
# Workers Scripts:Read
#
# Endpoint `https://api.cloudflare.com/client/v4/graphql` requires Cloudflare API permission:
# Account Analytics:Read
# #
- name: "☁️ CF › Check Project"
id: task_complete_project_check
shell: bash
run: |
yesturday=$(date --utc -d '-1 day' '+%FT%TZ')
now=$(date --utc +%FT%TZ)
worker_env=$(curl -s -X GET "https://api.cloudflare.com/client/v4/accounts/${{ secrets.CF_ACCOUNT_ID }}/workers/scripts/${{ env.WORKER_ID }}/settings/" \
-H "Authorization: Bearer ${{ secrets.CF_TOKEN }}" \
-H "Content-Type:application/json" | jq -r '.result.bindings[0].text')
echo "WORKER_ENV=$worker_env" >> $GITHUB_ENV
worker_compatdate=$(curl -s -X GET "https://api.cloudflare.com/client/v4/accounts/${{ secrets.CF_ACCOUNT_ID }}/workers/scripts/${{ env.WORKER_ID }}/settings/" \
-H "Authorization: Bearer ${{ secrets.CF_TOKEN }}" \
-H "Content-Type:application/json" | jq -r '.result.compatibility_date')
echo "WORKER_COMPATDATE=$worker_compatdate" >> $GITHUB_ENV
API_JSON=$(echo "{ \"query\":
\"query GetWorkersAnalytics(\$accountTag: string, \$datetimeStart: string, \$scriptName: string) {
viewer {
accounts(filter: {accountTag: \$accountTag}) {
workersInvocationsAdaptive(limit: 1000, filter: {
scriptName: \$scriptName,
datetime_geq: \$datetimeStart,
datetime_leq: \$datetimeEnd
}) {
sum {
subrequests
requests
errors
}
}
}
}
}\",
\"variables\": {
\"accountTag\": \"${{ secrets.CF_ACCOUNT_ID }}\",
\"datetimeStart\": \"$yesturday\",
\"datetimeEnd\": \"$now\",
\"scriptName\": \"${{ env.WORKER_ID }}\"
}
}" | curl --silent \
https://api.cloudflare.com/client/v4/graphql \
--header "Authorization: Bearer ${{ secrets.CF_TOKEN }}" \
--header "Accept: application/json" \
--header "Content-Type: application/json" \
--data @-)
api_err=$(echo $API_JSON | jq -r ".data.viewer.accounts[0].workersInvocationsAdaptive[0].sum.errors")
api_req=$(echo $API_JSON | jq -r ".data.viewer.accounts[0].workersInvocationsAdaptive[0].sum.requests")
api_req_sub=$(echo $API_JSON | jq -r ".data.viewer.accounts[0].workersInvocationsAdaptive[0].sum.subrequests")
echo "ENV_API_ERR=$api_err" >> $GITHUB_ENV
echo "ENV_API_REQ=$api_req" >> $GITHUB_ENV
echo "ENV_API_SUBREQ=$api_req_sub" >> $GITHUB_ENV
# #
# Job > Complete > Summary of publish
# #
- name: "🆗 Completed: ${{ env.NOW }}"
id: task_complete_summary
run: |
echo ""
echo ""
echo "| File | Result |" >> $GITHUB_STEP_SUMMARY
echo "| ------------------------------- | ----------------------- |" >> $GITHUB_STEP_SUMMARY
echo "| **Project** | ${{ env.PLUGIN_NAME }} |" >> $GITHUB_STEP_SUMMARY
echo "| **Deploy Time** | ${{ env.NOW }} |" >> $GITHUB_STEP_SUMMARY
echo "| **Worker Compatibility Date** | ${{ env.WORKER_COMPATDATE }} |" >> $GITHUB_STEP_SUMMARY
echo "| **Worker State** | ${{ env.WORKER_ENV }} |" >> $GITHUB_STEP_SUMMARY
echo "| **Worker Errors** | ${{ env.ENV_API_ERR }} |" >> $GITHUB_STEP_SUMMARY
echo "| **Worker Requests** | ${{ env.ENV_API_REQ }} |" >> $GITHUB_STEP_SUMMARY
echo "| **Worker Subrequests** | ${{ env.ENV_API_SUBREQ }} |" >> $GITHUB_STEP_SUMMARY