Skip to content

Commit 1728d3a

Browse files
committed
Update Push workflow
1 parent d661fa4 commit 1728d3a

File tree

1 file changed

+51
-37
lines changed

1 file changed

+51
-37
lines changed

.github/workflows/push.yml

Lines changed: 51 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ jobs:
5050

5151
#Upload cli compile json as artifact
5252
- name: Upload cli compile json
53-
if: github.event_name == 'pull_request'
5453
uses: actions/upload-artifact@v4
5554
with:
5655
name: pr_cli_compile_${{ matrix.chunk }}
@@ -120,42 +119,57 @@ jobs:
120119
echo CONFIG_FREERTOS_HZ=1000 > test/sdkconfig.defaults
121120
idf.py -C test -DEXTRA_COMPONENT_DIRS=$PWD/components build
122121
123-
# Ubuntu
124-
build-arduino-base-linux:
125-
name: Arduino Base ${{ matrix.chunk }} on ubuntu-latest
126-
#run if its on PR only
127-
if: github.event_name == 'pull_request'
122+
# Save artifacts to gh-pages
123+
save-master-artifacts:
124+
name: Save master artifacts
125+
needs: build-arduino-linux
126+
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
128127
runs-on: ubuntu-latest
129-
strategy:
130-
fail-fast: false
131-
matrix:
132-
chunk: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
133-
134-
# Checkout base branch
135128
steps:
136-
- uses: actions/checkout@v4
137-
with:
138-
ref: ${{ github.event.pull_request.base.ref }}
139-
- uses: actions/setup-python@v5
140-
with:
141-
python-version: '3.x'
142-
- name: Cache tools
143-
id: cache-linux
144-
uses: actions/cache@v4
145-
with:
146-
path: |
147-
./tools/dist
148-
~/arduino_ide
149-
key: ${{ runner.os }}-${{ hashFiles('package/package_esp32_index.template.json',
150-
'tools/get.py',
151-
'.github/scripts/install-arduino-ide.sh') }}
152-
- name: Build Sketches
153-
run: bash ./.github/scripts/on-push.sh ${{ matrix.chunk }} 15 1
129+
# Check out repository
130+
- name: Checkout repository
131+
uses: actions/checkout@v4
132+
with:
133+
token: ${{secrets.GITHUB_TOKEN}}
134+
fetch-depth: '0'
154135

155-
#Upload cli compile json as artifact
156-
- name: Upload cli compile json
157-
uses: actions/upload-artifact@v4
158-
with:
159-
name: master_cli_compile_${{ matrix.chunk }}
160-
path: cli_compile_${{ matrix.chunk }}.json
161-
overwrite: true
136+
- name: Switch branch
137+
run:
138+
git checkout remotes/origin/gh-pages
139+
140+
- name: Download sketches reports artifact
141+
uses: actions/download-artifact@v4
142+
with:
143+
pattern: pr_cli_compile_*
144+
merge-multiple: true
145+
path: master_cli_compile
146+
147+
- name: List files in the directory
148+
run: ls -R
149+
150+
- name: Commit json files to gh-pages if on master
151+
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
152+
run: |
153+
git config user.name github-actions
154+
git config user.email github-actions@github.com
155+
git add --all
156+
git commit -m "Updated cli compile json files"
157+
git push origin HEAD:gh-pages
158+
159+
#Upload PR number as artifact
160+
upload-pr-number:
161+
name: Upload PR number
162+
if: github.event_name == 'pull_request'
163+
runs-on: ubuntu-latest
164+
steps:
165+
- name: Save the PR number in an artifact
166+
shell: bash
167+
env:
168+
PR_NUM: ${{ github.event.number }}
169+
run: echo $PR_NUM > pr_num.txt
170+
- name: Upload PR number
171+
uses: actions/upload-artifact@v4
172+
with:
173+
name: pr_number
174+
path: ./pr_num.txt
175+
overwrite: true

0 commit comments

Comments
 (0)