update-collection #10
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: update-collection | |
permissions: | |
contents: write | |
on: | |
pull_request: | |
types: [closed] | |
#push: | |
# branches: | |
# - main # or any other branch you want to trigger the action | |
workflow_dispatch: | |
jobs: | |
update-collection: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v2 | |
- name: Set up PHP | |
uses: shivammathur/setup-php@v2 | |
with: | |
php-version: '7.4' # specify the PHP version | |
- name: Create config.php | |
working-directory: docs/updater | |
run: | | |
echo '<?php' > config.php | |
echo '// Configuration' >> config.php | |
echo "\$server = 'https://raw.githubusercontent.com/';" >> config.php | |
echo "\$repopath = 'eried/ArduboyCollection/'; // Source repository" >> config.php | |
echo '' >> config.php | |
echo '// Github credentials' >> config.php | |
echo "\$client_id='${{ secrets.CLIENT_ID }}';" >> config.php | |
echo "\$client_secret='${{ secrets.CLIENT_SECRET }}';" >> config.php | |
- name: Execute update.php | |
working-directory: docs/updater | |
run: php update.php | |
- name: Commit and Push changes | |
working-directory: docs | |
run: | | |
git config --local user.email "action@github.com" | |
git config --local user.name "GitHub Action" | |
git add repo.json | |
git add index.html | |
git commit -m "Repo update" -a || echo "No changes to commit" | |
##git push | |
git push https://${{ secrets.GITHUB_TOKEN }}@github.com/eried/ArduboyCollection.git |