-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: workflow to generate a QR code with inputs
- Loading branch information
1 parent
8a8fe07
commit f0134fc
Showing
1 changed file
with
66 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
name: Generate QR code | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
data: | ||
description: "The data for the QR code, e.g. a URL" | ||
required: true | ||
type: string | ||
color: | ||
description: "The color of the QR code (hex or name), defaults to black" | ||
default: "#000000" | ||
required: false | ||
type: string | ||
background: | ||
description: "The background color of the QR code in hex format, defaults to transparent" | ||
default: "transparent" | ||
required: false | ||
type: string | ||
size: | ||
description: "The size of the QR code from 1 (smallest) to 10 (largest), defaults to 4" | ||
default: 4 | ||
required: false | ||
type: choice | ||
options: | ||
- 1 | ||
- 2 | ||
- 3 | ||
- 4 | ||
- 5 | ||
- 6 | ||
- 7 | ||
- 8 | ||
- 9 | ||
- 10 | ||
|
||
jobs: | ||
generate-qr-code: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: "3.11" | ||
cache: pip | ||
cache-dependency-path: "qr_codes/requirements.txt" | ||
|
||
- name: Install dependencies | ||
run: pip install -r qr_codes/requirements.txt | ||
|
||
- name: Generate QR code | ||
run: | | ||
python qr_codes/main.py \ | ||
--color="${{ inputs.color }}" \ | ||
--background="${{ inputs.background }}" \ | ||
--size="${{ inputs.size }}" \ | ||
${{ inputs.data }} \ | ||
qr-code.png | ||
- name: Upload QR code as artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: qr-code.png | ||
path: qr-code.png |