Skip to content

update-collection

update-collection #3

name: update-collection
on:
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