Skip to content

Remove platformio refs #186

Remove platformio refs

Remove platformio refs #186

name: Update library zip and submodules
on:
push:
branches:
- master
schedule:
- cron: '0 1 * * 0'
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
permissions: # Job-level permissions configuration starts here
contents: write # 'write' access to repository contents
pull-requests: write # 'write' access to pull requests
if: "!contains(github.event.head_commit.message, 'ci skip')"
steps:
# check out the repo
- uses: actions/checkout@v4
with:
ref: master
submodules: false
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token
fetch-depth: 0 # otherwise, you will fail to push refs to dest repo
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
cache: 'pip'
- name: Install python dependencies
run: |
pip install --upgrade --upgrade-strategy only-if-needed -r requirements.txt
- name: Install submodules
run: |
git config --global user.email "[email protected]"
git config --global user.name "SRGDamia1"
git config --global push.default simple
git submodule init
git status
git submodule update --remote --recursive
git status
- name: Queue changes in submodules for commit
run: |
git add -A
git status
- name: Create submodule_status file
run: |
echo "::debug::Creating a new submodule status file.\n"
git submodule status --recursive > submodule_status.txt
git status
echo "::debug::Checking for changes in the submodule status file."
git diff HEAD -- submodule_status.txt
echo "::debug::Setting a new environment variable"
echo "submod_updated=$(git diff --name-only HEAD -- submodule_status.txt)" >> $GITHUB_ENV
echo "::debug::submodules updated = $submod_updated"
- name: Check env variable
run: echo submodules updated = $submod_updated
- name: Zip submodules
if: ${{ env.submod_updated }}
run: |
echo "::debug::Archiving Submodules."
git-archive-all --force-submodules libraries.zip
git status
- name: Remove git folders and files from zip
if: ${{ env.submod_updated }}
continue-on-error: true
run: |
echo "::debug::Deleting extra files to decrease size of zip"
echo "::debug::Removing Git folders"
zip -d -q libraries "*/.gitattributes" "*/.gitignore" "*/.gitmodules" "*/.github/*" "*.sh" "*/Doxyfile" "*/.travis.yml"
- name: Remove pdfs from the zip
if: ${{ env.submod_updated }}
continue-on-error: true
run: |
echo "::debug::Removing other pdfs"
zip -d -q libraries "*/doc/*.pdf"
- name: Remove TinyGSM extras from the zip
if: ${{ env.submod_updated }}
continue-on-error: true
run: |
echo "::debug::Removing TinyGSM extras"
zip -d -q libraries "*/TinyGSM/extras/*"
- name: Remove YosemitechModbus extras from the zip
if: ${{ env.submod_updated }}
continue-on-error: true
run: |
echo "::debug::Removing YosemitechModbus extras"
zip -d -q libraries "*/YosemitechModbus/doc/*"
- name: Remove SDFat extras from the zip
if: ${{ env.submod_updated }}
continue-on-error: true
run: |
echo "::debug::Removing SDFat extras"
zip -d -q libraries "*/SdFat/extras/*"
- name: Queue zip
if: ${{ env.submod_updated }}
run: |
echo "::debug::Queueing changes for commit"
git add -A;
echo "::debug::Git status"
git status
echo "::debug::Setting a new environment variable"
git diff --name-only HEAD -- libraries.zip
echo "is_changed=$(git diff --name-only HEAD -- libraries.zip)" >> $GITHUB_ENV
echo "::debug::zip changed = $is_changed"
- name: Check env variable
run: echo zip changed = $is_changed
- name: Commit changes to master
if: ${{ env.is_changed }}
run: |
git commit -m "Updated submodules and zip via Github Action (${{ github.workflow }} ${{ github.event_name }} ${{ github.run_number }} ) [ci skip]";
- name: Push changes to master
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: master
# - name: Checkout platformio branch
# run: |
# echo "::debug::Stashing changes before switching branches"
# git stash
# echo "::debug::Checking out the platformio branch"
# git checkout platformio
# git status
# echo "::debug::Checking out the library manifest from the master branch"
# git checkout master -- library.json
# git status
# echo "::debug::Queueing changes to the manifest for commit"
# git add library.json
# git status
# echo "::debug::Setting a new environment variable"
# git diff --name-only HEAD -- library.json
# echo "manifest_changed=$(git diff --name-only HEAD -- library.json)" >> $GITHUB_ENV
# echo "::debug::manifest changed = $manifest_changed"
# - name: Check env variable
# run: echo manifest changed = $manifest_changed
# - name: Commit changes to platformio branch
# if: ${{ env.manifest_changed }}
# run: git commit -m "Updated library.json via Github Action (${{ github.workflow }} ${{ github.event_name }} ${{ github.run_number }} ) [ci skip]";
# - name: Push to platformio branch
# if: ${{ env.manifest_changed }}
# uses: ad-m/github-push-action@master
# with:
# github_token: ${{ secrets.GITHUB_TOKEN }}
# branch: platformio