Skip to content

Commit

Permalink
Update gh-pages
Browse files Browse the repository at this point in the history
  • Loading branch information
actions-user committed Jul 28, 2023
0 parents commit 72e6c41
Show file tree
Hide file tree
Showing 4 changed files with 97 additions and 0 deletions.
77 changes: 77 additions & 0 deletions .github/workflows/updatehymnals.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Deploy to gh-pages and Create Repos

on:
push:
branches:
- master # Adjust the branch name to the branch you want to trigger the deployment

jobs:
deploy_and_create_repos:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Deploy to gh-pages
run: |
git config --global user.name 'GitHub Actions'
git config --global user.email '[email protected]'
git branch -a # Optional: Display branches for debugging purposes
git checkout gh-pages || git checkout --orphan gh-pages
git add .
git commit -m 'Update gh-pages'
git push origin gh-pages -f
- name: Create Repos
run: |
# hymnals=$(cat hymnals.yaml | grep -o "'[^\']*'" | sed "s/'//g")
cat hymnals.yaml | grep -o "'[^\']*'" | sed "s/'//g" | while read -r hymnal; do
echo "=>$hymnal"
# REPO_NAME=$(echo "$hymnal" | sed 's/-/_/g') # Replace hyphens with underscores for valid repository names
REPO_NAME="$hymnal"
ORG_NAME=${{ github.repository_owner }}
# Check if the repository exists
RESPONSE=$(curl -s -o /dev/null -w "%{http_code}" "https://api.github.com/repos/$ORG_NAME/$REPO_NAME")
if [ "$RESPONSE" -eq 200 ]; then
# ## Repository exists, delete it using GitHub API
# curl -X DELETE \
# -H "Authorization: token ${{ secrets.CREATE_AH_REPOS }}" \
# "https://api.github.com/repos/$ORG_NAME/$REPO_NAME"
continue
fi
# Create the new repository using GitHub API
curl -X POST \
-H "Authorization: token ${{ secrets.CREATE_AH_REPOS }}" \
-H "Content-Type: application/json" \
-d "{\"name\":\"$REPO_NAME\", \"description\":\"$REPO_NAME in v4 format\", \"private\":false,\"has_issues\":true,\"has_projects\":true,\"has_wiki\":true}" \
"https://api.github.com/orgs/$ORG_NAME/repos"
#cd /tmp
#csycmsLink=$(echo "$REPO_NAME"|sed -e 's/v4$/csycms/')
#echo $csycmsLink
##git clone "[email protected]:adventHymnals/$csycmsLink.git"
##git clone "https://username:${{ secrets.CREATE_AH_REPOS }}@github.com/$ORG_NAME/$csycmsLink.git"
#git clone "https://github.com/adventHymnals/$csycmsLink.git"
#cd "$csycmsLink"
#ls
#ls -lha
#git remote set-url origin "[email protected]:adventHymnals/$REPO_NAME.git"
#git config --unset-all http.https://github.com/.extraheader
#git push "https://username:${{ secrets.CREATE_AH_REPOS }}@github.com/$ORG_NAME/$REPO_NAME.git" master
done
REPO_NAME="advent_hymnals_v4"
ORG_NAME=${{ github.repository_owner }}
# Check if the repository exists
#RESPONSE=$(curl -s -o /dev/null -w "%{http_code}" "https://api.github.com/repos/$ORG_NAME/$REPO_NAME")
curl -X POST \
-H "Authorization: token ${{ secrets.CREATE_AH_REPOS }}" \
-H "Content-Type: application/json" \
-d "{\"name\":\"$REPO_NAME\", \"description\":\"$REPO_NAME in v4 format\", \"private\":false,\"has_issues\":true,\"has_projects\":true,\"has_wiki\":true}" \
"https://api.github.com/orgs/$ORG_NAME/repos"
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# hymnals_repo
Repository for hymnals information

This repo creates:
1. adventhymnals_v4
2. _v4 repos for all hymnals in hymnals.yaml

hymnals.yaml is update using a [colab notebook](https://colab.research.google.com/drive/1Hks_1wzoyTGIBk0nixQb1vZaNp_NYpaw)
11 changes: 11 additions & 0 deletions hymnals.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
hymnals:
- 'campus-melodies-v4'
- 'hymns-for-the-poor-of-the-flock-v4'
- 'millenial-harp-v4'
- 'Hymns-for-Gods-Peculiar-People-v4'
- 'christ-in-song-v4'
- 'church-hymnal-v4'
- 'seventh-day-adventist-hymnal-v4'
- 'nyimbo-za-kristo-v4'
- 'wende-nyasaye-v4'
- 'songs-for-worship-v4'
1 change: 1 addition & 0 deletions tmp
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Mon Jul 24 11:37:34 AM UTC 2023

0 comments on commit 72e6c41

Please sign in to comment.