Skip to content

Commit

Permalink
ADDED: signatures for O and X
Browse files Browse the repository at this point in the history
  • Loading branch information
AleixMT committed Apr 9, 2024
1 parent b0a8886 commit 95b023f
Show file tree
Hide file tree
Showing 5 changed files with 124 additions and 2 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/buildAndSendOSignatures.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: buildAndSendJSignatures

on:
push:
branches:
- 'master'
paths:
- 'data/X.json'
- 'templates/template.html'

env:
O_NAME: ${{ secrets._NAME }}
O_PHONE: ${{ secrets.O_PHONE }}
O_IPHONE: ${{ secrets.O_IPHONE }}
O_EMAIL: ${{ secrets.O_EMAIL }}
GH_ACTIONS_ENV: true

jobs:
build_and_send_signatures:
runs-on: ubuntu-latest
steps:
-
name: Checkout code
uses: actions/checkout@v3
-
name: Substitute marks (implicit parameters in env)
run: |
chmod u+x src/substituteMarks.sh
./src/substituteMarks.sh
-
name: Set up nodeJS
uses: actions/setup-node@v4
with:
node-version: '20.x'
-
name: Render signatures
run: |
npm install
node ./src/renderSignatures.js
-
name: Send emails
uses: dawidd6/action-send-mail@v3
with:
server_address: smtp.gmail.com
server_port: 465
secure: true
username: ${{secrets.EMAIL_USERNAME}}
password: ${{secrets.EMAIL_PASSWORD}}
subject: Actualització de firmes electròniques
to: ${{secrets.O_EMAIL}}, ${{secrets.EMAIL_USERNAME}}
from: ${{secrets.EMAIL_USERNAME}}
body: Aquest missatge ha estat auto-generat.
ignore_cert: true
attachments: ./out/*.html
priority: low
55 changes: 55 additions & 0 deletions .github/workflows/buildAndSendXSignatures.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: buildAndSendJSignatures

on:
push:
branches:
- 'master'
paths:
- 'data/X.json'
- 'templates/template.html'

env:
X_NAME: ${{ secrets._NAME }}
X_PHONE: ${{ secrets.X_PHONE }}
X_IPHONE: ${{ secrets.X_IPHONE }}
X_EMAIL: ${{ secrets.X_EMAIL }}
GH_ACTIONS_ENV: true

jobs:
build_and_send_signatures:
runs-on: ubuntu-latest
steps:
-
name: Checkout code
uses: actions/checkout@v3
-
name: Substitute marks (implicit parameters in env)
run: |
chmod u+x src/substituteMarks.sh
./src/substituteMarks.sh
-
name: Set up nodeJS
uses: actions/setup-node@v4
with:
node-version: '20.x'
-
name: Render signatures
run: |
npm install
node ./src/renderSignatures.js
-
name: Send emails
uses: dawidd6/action-send-mail@v3
with:
server_address: smtp.gmail.com
server_port: 465
secure: true
username: ${{secrets.EMAIL_USERNAME}}
password: ${{secrets.EMAIL_PASSWORD}}
subject: Actualització de firmes electròniques
to: ${{secrets.X_EMAIL}}, ${{secrets.EMAIL_USERNAME}}
from: ${{secrets.EMAIL_USERNAME}}
body: Aquest missatge ha estat auto-generat.
ignore_cert: true
attachments: ./out/*.html
priority: low
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ If there is the need to add a new signature you need a workflow that manages tha
and the phone with international prefix (without spaces to generate a proper `mailto:` link), where N is the initial
or
another string that identifies the person but without revealing any of its personal data.
- Create the file N.json in the `data` folder. N needs to be the same.
- Create the file `N.json` in the `data` folder. N needs to be the same.
- Create the workflow `sendSignatureToN.yml` that is configured to send the signature to its owner and is triggered only
when the signature is modified.
- Add the files, commit and push to GitHub to trigger the workflow.
Expand All @@ -95,7 +95,7 @@ whitespace or a line break.

Since the workflow is only triggered
when the signature is updated, you can add a meaningless change in the data file of the signature such as adding a
whitespace or a line break.
whitespace or a line break to trigger the workflow and receive the signatures in your email.

## Roadmap
This project is completely functional! But there is still some space for improvements...
Expand Down
6 changes: 6 additions & 0 deletions data/O.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "{{O_NAME}}",
"phone": "{{O_PHONE}}",
"internationalPhone": "{{O_IPHONE}}",
"email": "{{O_EMAIL}}"
}
6 changes: 6 additions & 0 deletions data/X.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"name": "{{X_NAME}}",
"phone": "{{X_PHONE}}",
"internationalPhone": "{{X_IPHONE}}",
"email": "{{X_EMAIL}}"
}

0 comments on commit 95b023f

Please sign in to comment.