diff --git a/.github/workflows/today.yml b/.github/workflows/today.yml index df03c8bf..a9d25c7c 100644 --- a/.github/workflows/today.yml +++ b/.github/workflows/today.yml @@ -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/git-clone-action@v1.0.0 - with: - repository: trueChristian/daily_light - ref: master - name: Setup gitHub User Details env: GIT_USER: ${{ secrets.GIT_USER }} @@ -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 git@github.com: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 diff --git a/src/setGithubUser.sh b/src/setGithubUser.sh index 0da580ab..5e9074fc 100755 --- a/src/setGithubUser.sh +++ b/src/setGithubUser.sh @@ -7,6 +7,7 @@ SSH_KEY="" SSH_PUB="" GIT_USER="" GIT_EMAIL="" +SIGNKEY="" # check if we have options while :; do @@ -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 @@ -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 @@ -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 diff --git a/src/today.sh b/src/today.sh index 2135e561..d0332c2c 100644 --- a/src/today.sh +++ b/src/today.sh @@ -43,7 +43,7 @@ EVENING="

${E_TIME_N}

${DAILYLIGHT}

${DAILYLIGHT[$E_TIME_V]}

" -TELEGRAM_LINK="

${TODAY_DATE}

" +TELEGRAM_LINK="

${TODAY_DATE}

" #████████████████████████████████████████ SET TODAY'S MESSAGES IN MARKDOWN ███ @@ -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 ███ @@ -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