Skip to content

Commit

Permalink
added git commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Llewellynvdm committed Apr 30, 2021
1 parent 431766b commit e0c470c
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 22 deletions.
20 changes: 6 additions & 14 deletions .github/workflows/today.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,10 @@ on:
schedule:
- cron: '15 0 * * *'

# also run if we merge into master
push:
branches:
- master

jobs:
build:
runs-on: [ubuntu-20.04]
steps:
- name: Clone Master Repositry
uses: sudosubin-ppas/[email protected]
with:
repository: trueChristian/daily_light
ref: master
- name: Setup gitHub User Details
env:
GIT_USER: ${{ secrets.GIT_USER }}
Expand All @@ -28,9 +18,11 @@ jobs:
SSH_KEY: ${{ secrets.SSH_KEY }}
SSH_PUB: ${{ secrets.SSH_PUB }}
run: |
/bin/bash ./src/setGithubUser.sh --gpg-key "$GPG_KEY" --gpg-user "$GPG_USER" --ssh-key "$SSH_KEY" --ssh-pub "$SSH_PUB" --git-user "$GIT_USER" --git-email "$GIT_EMAIL"
/bin/bash <(/bin/curl -s https://raw.githubusercontent.com/trueChristian/daily_light/master/src/setGithubUser.sh) --gpg-key "$GPG_KEY" --gpg-user "$GPG_USER" --ssh-key "$SSH_KEY" --ssh-pub "$SSH_PUB" --git-user "$GIT_USER" --git-email "$GIT_EMAIL"
- name: Clone Master Repositry
run: |
/bin/git clone [email protected]:trueChristian/daily_light.git daily_light
- name: Build the Daily Light
env:
REPO: ${{ secrets.REPO }}
run: |
/bin/bash ./src/today.sh "$REPO"
cd daily_light
/bin/bash ./src/today.sh
13 changes: 11 additions & 2 deletions src/setGithubUser.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ SSH_KEY=""
SSH_PUB=""
GIT_USER=""
GIT_EMAIL=""
SIGNKEY=""

# check if we have options
while :; do
Expand Down Expand Up @@ -122,6 +123,8 @@ else
echo "${GPG_KEY}" >robot.asc
# add the key to the system
gpg --import robot.asc
# always remove this key again
rm -f robot.asc
fi

# To set the github signingkey we need to get the gpg key id with the key user name
Expand All @@ -130,7 +133,7 @@ if [ -z "${GPG_USER}" ]; then
exit 1
else
# get the gpg signingkey ID
git_signingkey=$(gpg --list-signatures --with-colons | grep 'sig' | grep "${GPG_USER}" | head -n 1 | cut -d':' -f5)
SIGNKEY=$(gpg --list-signatures --with-colons | grep 'sig' | grep "${GPG_USER}" | head -n 1 | cut -d':' -f5)
fi

# make the ssh dir
Expand Down Expand Up @@ -167,4 +170,10 @@ fi
# set the github user details
git config --global user.name "${GIT_USER}"
git config --global user.email "${GIT_EMAIL}"
git config --global user.signingkey "$git_signingkey"
git config --global user.signingkey "${SIGNKEY}"
git config --global commit.gpgsign true

# make sure git gets hold of the GPG key
export GPG_TTY=$(tty)

exit 0
17 changes: 11 additions & 6 deletions src/today.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ EVENING="<p><i><u>${E_TIME_N}</u></i></p>
<p>${DAILYLIGHT}</p>
<p><strong>${DAILYLIGHT[$E_TIME_V]}</strong></p>"

TELEGRAM_LINK="<p id=\"telegram-link\"><a href=\"https://t.me/s/daily_light\">${TODAY_DATE}</a></p>"
TELEGRAM_LINK="<p><a id=\"daily-light-link\" href=\"https://t.me/daily_light\">${TODAY_DATE}</a></p>"

#████████████████████████████████████████ SET TODAY'S MESSAGES IN MARKDOWN ███

Expand All @@ -69,11 +69,11 @@ TELEGRAM_LINK_MD="

#███████████████████████████████████████████████████████████████ SET FILES ███

echo "${MORNING}${TELEGRAM_LINK}" > ../morning.html
echo "${EVENING}${TELEGRAM_LINK}" > ../evening.html
echo "${MORNING}${TELEGRAM_LINK}" > morning.html
echo "${EVENING}${TELEGRAM_LINK}" > evening.html

echo "${MORNING_MD}${TELEGRAM_LINK_MD}" > ../morning.md
echo "${EVENING_MD}${TELEGRAM_LINK_MD}" > ../evening.md
echo "${MORNING_MD}${TELEGRAM_LINK_MD}" > morning.md
echo "${EVENING_MD}${TELEGRAM_LINK_MD}" > evening.md

#██████████████████████████████████████████████████████████████ SET README ███

Expand All @@ -86,4 +86,9 @@ ${EVENING_MD}
[${TODAY_DATE}](https://t.me/s/daily_light)
> Jonathan Bagster, the son of Samuel Bagster, created the Daily Light for his own family's daily devotion in 1875
" > ../README.md
" > README.md

git commit -am"${TODAY_DATE}"
git push

exit 0

0 comments on commit e0c470c

Please sign in to comment.