Skip to content

Commit f00c304

Browse files
committed
Workflow update
1 parent 99c7f9f commit f00c304

2 files changed

Lines changed: 27 additions & 3 deletions

File tree

.github/workflows/main.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,13 +88,13 @@ jobs:
8888
with:
8989
name: Build-Android
9090
path: Build/Android
91+
- name: Install dotnet-script
92+
run: dotnet tool install -g dotnet-script
9193
- name: Generate QR Code
9294
id: generate_qr
9395
run: |
9496
apk_url=$(gh api -X GET "repos/${{ github.repository }}/actions/artifacts" | jq -r '.artifacts[] | select(.name=="Build-Android") | .archive_download_url')
95-
echo $apk_url > apk_url.txt
96-
pip install qrcode[pil]
97-
python -m qrcode --output=qr_code.png $apk_url
97+
dotnet-script ./scripts/generate-qr.csx $apk_url qr_code.png
9898
- name: Upload QR Code
9999
uses: actions/upload-artifact@v3
100100
with:
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/usr/bin/env dotnet-script
2+
3+
#r "nuget: QRCoder"
4+
5+
using QRCoder;
6+
using System;
7+
using System.IO;
8+
9+
if (args.Length != 2)
10+
{
11+
Console.WriteLine("Usage: dotnet-script generate-qr.csx <url> <output-file>");
12+
return;
13+
}
14+
15+
string url = args[0];
16+
string outputFile = args[1];
17+
18+
QRCodeGenerator qrGenerator = new QRCodeGenerator();
19+
QRCodeData qrCodeData = qrGenerator.CreateQrCode(url, QRCodeGenerator.ECCLevel.Q);
20+
PngByteQRCode qrCode = new PngByteQRCode(qrCodeData);
21+
byte[] qrCodeImage = qrCode.GetGraphic(20);
22+
23+
File.WriteAllBytes(outputFile, qrCodeImage);
24+
Console.WriteLine($"QR Code saved to {outputFile}");

0 commit comments

Comments
 (0)