Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/generator'
Browse files Browse the repository at this point in the history
  • Loading branch information
xeon-zolt committed Aug 5, 2017
2 parents 29bf225 + 15c3183 commit b665ce7
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 18 deletions.
27 changes: 11 additions & 16 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,37 +1,32 @@
# This provides us with GCC binary support so we can run bash
dist: trusty
language: generic
language: generic<number> commit message`


git:
depth: 1

sudo: required

script:
- ./build1.sh
- ./build1.sh |& tee log.txt

before_deploy:
- sudo rm meilix-original.iso
- export image_name="`echo *.iso`"
- cat *.iso > "/home/travis/${image_name}"
- curl --upload-file /home/travis/${image_name} https://transfer.sh/Meilix.ISO

on_success: always

deploy:
- provider: releases
skip_cleanup: true
overwrite: true
tag_name: $TRAVIS_TAG
api_key:
secure: "KsbMe/CzvYmGvWoflBRjfiw8urvAZhNE/oL51HceeIeAeQ+Kr0jM/BRV+kG0c6scKwePknr02A7XqBwAEmUAYWNGd0TiRo5lIQxCONpPsYXwEtHSuA2+0pRuVN4qG+6sgYHvlNO7UbWgVu/aAapufTpIkUctHWHQRJUDN8+hUrfeRm4CjeA7Tz4y1KYzRNY4SrwQyEVLwxoTZ/DOuSjj3m40jrwOsBnql/SSYe6D8N2r0tv5Acs/qmClEUhQW26OB4tRRRgS9jXU2gni2ZEYV0h6D5aKehW6gWlZpK5Rdn5QEY2py+Mar29wF2nxAojD+chLgzxx3zjB5Dm6ERpzEznjffMEpBxlEEMO3uniOJjokn0k2IVsoZTvM9rCbBfFuD7+Ihv5nhZYM7Mc5iKZE1Tx6XW2ZX9LW7ebjP+jNmqLuBHUu3oAVeD9ZscdmHVnNFr1TNE+ZVAvSDfA73AaT+sT3TNF5SwYPyAH7uk8lHfUhS+rIAmX8efrSIUoaVSwy1Wzop6c2YbYGJq4RxqEEkCiE0aB6ldgXAA95uUcYzTkKL/i1myJK/DLpu+qV3AXhxVIpYqekhTEZmLMpCnXXEzPwsAe1CfEy4h0VV2ax51u+cAOhLcKZBRzDAJOd7dqAA6GpV24OOfP3VKqRxCWfYPtsLPoei6h9QWvWrYuC80="

file_glob: true # http://stackoverflow.com/a/28579635/1320237
file: "/home/travis/${image_name}"
- provider: script
script: curl --upload-file /home/travis/${image_name} https://transfer.sh/Meilix.ISO
on:
tags: true
branch: upload-test

after_deploy:
- ./mail.py

branch: master

- cd mail-scripts && ./mail.py
after_failure:
- cd mail-scripts && ./mail-fail.py
5 changes: 5 additions & 0 deletions build1.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,15 @@ chmod +x meilix-generator.sh browser.sh
echo "$(<meilix-generator.sh)" #to test the file
./meilix-generator.sh
rm meilix-generator.sh
#change host name
hostname ${TRAVIS_TAG}
./browser.sh
rm browser.sh
chmod +x set-wallpaper.sh && ./set-wallpaper.sh
#delete temporary files
rm meilix-generator.sh
rm -rf /tmp/* ~/.bash_history
Expand Down
33 changes: 33 additions & 0 deletions mail-scripts/mail-fail.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#! /usr/bin/env python3
import http.client
import os
import datetime
import base64

#attachment encoding
with open('log.txt','rb') as f:
data = f.read()
f.close()

attachment = base64.b64encode(data)

conn = http.client.HTTPSConnection("api.sendgrid.com")

print (os.environ["email"])
payload = "{\"personalizations\":[{\"to\":[{\"email\":\"" + os.environ["email"] + "\"}],\"subject\":\"Your ISO is Ready\"}],\"from\":{\"email\":\"[email protected]\",\"name\":\"Meilix Generator\"},\"reply_to\":{\"email\":\"[email protected]\",\"name\":\"Meilix Generator\"},\"subject\":\"Your ISO is ready\",\"content\":[{\"type\":\"text/html\",\"value\":\"<html><p>Hi,<br>Your Build Gave error please report it to the developer<br><br>Thank You,<br>Meilix Generator Team</p></html>\"}],\"attachments\":[{\"content\":\""+str(attachment)[2:-1]+"\",\"type\":\"text/plain\",\"filename\":\"log.txt\"}]}"

print (type(payload))

authorization = "Bearer " + os.environ["mail_api_key"]

headers = {
'authorization': authorization,
'content-type': "application/json"
}

conn.request("POST", "/v3/mail/send", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
12 changes: 10 additions & 2 deletions mail.py → mail-scripts/mail.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,26 @@
import http.client
import os
import datetime
import base64

#attachment encoding
with open('log.txt','rb') as f:
data = f.read()
f.close()

attachment = base64.b64encode(data)

conn = http.client.HTTPSConnection("api.sendgrid.com")

date = datetime.datetime.now().strftime('%Y%m%d')
url = "https://github.com/xeon-zolt/meilix/releases/download/"+os.environ["TRAVIS_TAG"]+"/meilix-i386-custom.iso"

print (os.environ["email"])
payload = "{\"personalizations\":[{\"to\":[{\"email\":\"" + os.environ["email"] + "\"}],\"subject\":\"Your ISO is Ready\"}],\"from\":{\"email\":\"[email protected]\",\"name\":\"Meilix Generator\"},\"reply_to\":{\"email\":\"[email protected]\",\"name\":\"Meilix Generator\"},\"subject\":\"Your ISO is ready\",\"content\":[{\"type\":\"text/html\",\"value\":\"<html><p>Hi,<br>Your ISO is ready<br>URL : "+url+"<br><br>Thank You,<br>Meilix Generator Team</p></html>\"}]}"
payload = "{\"personalizations\":[{\"to\":[{\"email\":\"" + os.environ["email"] + "\"}],\"subject\":\"Your ISO is Ready\"}],\"from\":{\"email\":\"[email protected]\",\"name\":\"Meilix Generator\"},\"reply_to\":{\"email\":\"[email protected]\",\"name\":\"Meilix Generator\"},\"subject\":\"Your ISO is ready\",\"content\":[{\"type\":\"text/html\",\"value\":\"<html><p>Hi,<br>Your ISO is ready<br>URL : "+url+"<br><br>Thank You,<br>Meilix Generator Team</p></html>\"}],\"attachments\":[{\"content\":\""+str(attachment)[2:-1]+"\",\"type\":\"text/plain\",\"filename\":\"log.txt\"}]}"

print (type(payload))

authorization = "Bearer " + os.environ["mail_api_key"]
authorization = "Bearer " + os.environ["mail_api_key"]

headers = {
'authorization': authorization,
Expand Down

0 comments on commit b665ce7

Please sign in to comment.