Skip to content

Commit be5b2c5

Browse files
committed
feat: Added workflow to automatically update files, create PR and build installer
1 parent 6a9099b commit be5b2c5

File tree

5 files changed

+405
-60
lines changed

5 files changed

+405
-60
lines changed
Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,26 @@
11
name: build-espressif-ide-installer
22

33
on:
4-
workflow_dispatch:
4+
workflow_call:
55
inputs:
6-
espressif_ide_version:
7-
description: 'Espressif IDE version'
8-
required: true
9-
default: '2.9.1'
106
esp_idf_version:
11-
description: 'ESP-IDF version'
127
required: true
13-
default: '5.0.1'
14-
python_version:
15-
description: 'Python version'
8+
type: string
9+
espressif_ide_version:
1610
required: true
17-
default: '3.11'
11+
type: string
1812

1913
jobs:
2014
build-espressif-ide-installer:
2115
name: Build Installer
2216
runs-on: windows-latest
2317
steps:
2418
- name: Checkout repository
25-
uses: actions/checkout@v3
19+
uses: actions/checkout@v4
2620
- name: Inputs Logged
2721
run: |
2822
echo "Received Espressif IDE Version: ${{ github.event.inputs.espressif_ide_version }}"
2923
echo "Received ESP-IDF Version: ${{ github.event.inputs.esp_idf_version }}"
30-
echo "Received Python Version: ${{ github.event.inputs.python_version }}"
3124
- name: Map local long path to new drive
3225
id: map_path
3326
shell: pwsh
@@ -36,9 +29,9 @@ jobs:
3629
shell: pwsh
3730
run: choco install innosetup
3831
- name: Set up Python
39-
uses: actions/setup-python@v4
32+
uses: actions/setup-python@v5
4033
with:
41-
python-version: '${{ github.event.inputs.python_version }}'
34+
python-version: '3.11'
4235
- name: Install Inno Setup Download plugin
4336
shell: pwsh
4437
run: Invoke-WebRequest -Uri https://github.com/espressif/inno-download-plugin/releases/download/v1.5.1/idpsetup-1.5.1.exe -OutFile idpsetup.exe; .\idpsetup.exe /SILENT; Sleep 5
@@ -48,15 +41,15 @@ jobs:
4841
CERTIFICATE_PASSWORD: ${{ secrets.CERTIFICATE_PASSWORD }}
4942
shell: pwsh
5043
working-directory: "P:"
51-
run: .\Build-Installer.ps1 -InstallerType espressif-ide -OfflineBranch "v${{ github.event.inputs.esp_idf_version }}" -EspressifIdeVersion "${{ github.event.inputs.espressif_ide_version }}"
44+
run: .\Build-Installer.ps1 -InstallerType espressif-ide -OfflineBranch "v${{ inputs.esp_idf_version }}" -EspressifIdeVersion "${{ inputs.espressif_ide_version }}"
5245
- name: Create Release
5346
id: create_release
5447
uses: actions/create-release@v1
5548
env:
5649
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5750
with:
58-
tag_name: espressif-ide-${{ github.event.inputs.espressif_ide_version }}-esp-idf-${{ github.event.inputs.esp_idf_version }}
59-
release_name: Release of Espressif IDE ${{ github.event.inputs.espressif_ide_version }} with ESP-IDF ${{ github.event.inputs.esp_idf_version }}
51+
tag_name: espressif-ide-${{ inputs.espressif_ide_version }}-esp-idf-${{ inputs.esp_idf_version }}
52+
release_name: Release of Espressif IDE ${{ inputs.espressif_ide_version }} with ESP-IDF ${{ inputs.esp_idf_version }}
6053
draft: true
6154
prerelease: true
6255
- name: Upload Release Asset To Github
@@ -66,8 +59,8 @@ jobs:
6659
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6760
with:
6861
upload_url: ${{ steps.create_release.outputs.upload_url }}
69-
asset_path: ./build/espressif-ide-setup-espressif-ide-with-esp-idf-${{ github.event.inputs.esp_idf_version }}-signed.exe
70-
asset_name: espressif-ide-setup-${{ github.event.inputs.espressif_ide_version }}-with-esp-idf-${{ github.event.inputs.esp_idf_version }}.exe
62+
asset_path: ./build/espressif-ide-setup-espressif-ide-with-esp-idf-${{ inputs.esp_idf_version }}-signed.exe
63+
asset_name: espressif-ide-setup-${{ inputs.espressif_ide_version }}-with-esp-idf-${{ inputs.esp_idf_version }}.exe
7164
asset_content_type: application/octet-stream
7265
- name: Upload Release Asset To dl.espressif.com
7366
id: upload-release-asset-espressif
@@ -76,4 +69,4 @@ jobs:
7669
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
7770
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }}
7871
shell: pwsh
79-
run: aws s3 cp --acl=public-read --no-progress ./build/espressif-ide-setup-espressif-ide-with-esp-idf-${{ github.event.inputs.esp_idf_version }}-signed.exe s3://${{ secrets.DL_BUCKET }}/dl/idf-installer/espressif-ide-setup-${{ github.event.inputs.espressif_ide_version }}-with-esp-idf-${{ github.event.inputs.esp_idf_version }}.exe
72+
run: aws s3 cp --acl=public-read --no-progress ./build/espressif-ide-setup-espressif-ide-with-esp-idf-${{ inputs.esp_idf_version }}-signed.exe s3://${{ secrets.DL_BUCKET }}/dl/idf-installer/espressif-ide-setup-${{ inputs.espressif_ide_version }}-with-esp-idf-${{ inputs.esp_idf_version }}.exe
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
name: build-installer-any
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
installer_type:
7+
type: choice
8+
description: 'Installer Type'
9+
required: true
10+
options:
11+
- offline
12+
- espressif-ide
13+
- online
14+
esp_idf_version:
15+
description: 'ESP-IDF version (e.g. 5.2 or 5.2.1)'
16+
required: false
17+
default: '5.2.1'
18+
espressif_ide_version:
19+
description: 'Espressif IDE version (e.g. 2.0.0)'
20+
required: false
21+
default: ''
22+
online_installer_version:
23+
description: 'Online Installer version (e.g. 2.0)'
24+
required: false
25+
default: ''
26+
pull_request: # TODO Remove this once the workflow is tested
27+
28+
env:
29+
INSTALLER_TYPE: "offline" #${{ inputs.installer_type }}
30+
ESP_IDF_VERSION: "4.4.7" #${{ inputs.esp_idf_version }}
31+
ESPRESSIF_IDE_VERSION: #${{ inputs.espressif_ide_version }}
32+
ONLINE_INSTALLER_VERSION: "" #${{ inputs.online_installer_version }}
33+
34+
jobs:
35+
# build-installer-online:
36+
# #needs: update-docs-files
37+
# name: Build Online Installer
38+
# #if: ${{ env.INSTALLER_TYPE }} == 'online'
39+
# uses: espressif/idf-installer/.github/workflows/build-online-installer.yml@feat/automatic_installer_release # TODO
40+
# with:
41+
# online_installer_version: ${{ inputs.online_installer_version }}
42+
# secrets: inherit
43+
44+
build-installer-offline:
45+
#needs: update-docs-files
46+
name: Build Offline Installer
47+
# if: ${{ env.INSTALLER_TYPE }} == 'offline'
48+
uses: espressif/idf-installer/.github/workflows/build-offline-installer.yml@feat/automatic_installer_release # TODO
49+
with:
50+
esp_idf_version: "4.4.7"
51+
secrets: inherit
52+
53+
# build-installer-ide:
54+
# needs: update-docs-files
55+
# name: Build IDE Installer
56+
# if: ${{ env.INSTALLER_TYPE }} == 'espressif-ide'
57+
# uses: espressif/idf-installer/.github/workflows/build-espressif-ide-installer.yml@feat/automatic_installer_release # TODO
58+
# with:
59+
# esp_idf_version: ${{ env.ESP_IDF_VERSION }}
60+
# espressif_ide_version: ${{ env.ESPRESSIF_IDE_VERSION }}
61+
# secrets: inherit
62+
63+
update-docs-files:
64+
needs: build-installer-offline
65+
name: Build ${{ inputs.installer_type}} Installer
66+
runs-on: windows-latest
67+
strategy:
68+
fail-fast: false
69+
steps:
70+
- name: Checkout repository
71+
uses: actions/checkout@v4
72+
73+
- name: Set up Python
74+
uses: actions/setup-python@v5
75+
with:
76+
python-version: '3.11'
77+
78+
- name: Download artifacts
79+
uses: actions/download-artifact@v4
80+
with:
81+
name: installer-size
82+
path: ./
83+
84+
- name: Get size of online installer and Update docs files
85+
run: |
86+
echo "Instaler size from variable is $(Get-Content variables.txt)"
87+
88+
$size_bytes = [int]$(Get-Content variables.txt)
89+
# Check if the content is larger than 100000
90+
if ($size_bytes -gt 9999999) {
91+
$result = [math]::Round($size_bytes / 1000000000,2)
92+
$installer_size = "$result GB"
93+
echo "INSTALLER_SIZE: $installer_size"
94+
} else {
95+
$result = [math]::Round($size_bytes / 1000000,2)
96+
$installer_size = "$result MB"
97+
echo "INSTALLER_SIZE: $installer_size"
98+
}
99+
100+
python scripts/docs_update_release.py $installer_size
101+
102+
- name: Delete variables.txt
103+
run: |
104+
Remove-Item -Path variables.txt -Force
105+
106+
- name: Create Pull Request
107+
uses: peter-evans/create-pull-request@v6
108+
with:
109+
token: ${{ secrets.GITHUB_TOKEN }}
110+
commit-message: 'Release ${{ env.INSTALLER_TYPE }} installer ${{env.ESPRESSIF_IDE_VERSION}}${{env.ONLINE_INSTALLER_VERSION}} with ESP-IDF v${{ env.ESP_IDF_VERSION }}'
111+
title: 'Release ${{ env.INSTALLER_TYPE }} installer ${{env.ESPRESSIF_IDE_VERSION}}${{env.ONLINE_INSTALLER_VERSION}} with ESP-IDF v${{ env.ESP_IDF_VERSION }}'
112+
body: '- Updated docs files'
113+
branch: 'release-${{ env.INSTALLER_TYPE }}-installer'
114+
delete-branch: true
115+
base: 'main'
Lines changed: 33 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,62 @@
11
name: build-offline-installer
22

33
on:
4-
workflow_dispatch:
5-
6-
push:
7-
tags:
8-
- offline-*
4+
workflow_call:
5+
inputs:
6+
esp_idf_version:
7+
required: true
8+
type: string
9+
10+
env:
11+
IDF_BRANCH: ${{ inputs.esp_idf_version }}
12+
VERSION: 'offline-${{ inputs.esp_idf_version }}'
913

1014
jobs:
1115
build-offline-installer:
1216
name: Build Installer
1317
runs-on: windows-latest
1418
steps:
1519
- name: Checkout repository
16-
uses: actions/checkout@v3
17-
- name: Get the version
18-
id: get_version
19-
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
20-
shell: bash
21-
- name: Get the installer type
22-
id: get_installer_type
23-
run: echo ::set-output name=INSTALLER_TYPE::${${{ steps.get_version.outputs.VERSION }}//-*}
24-
shell: bash
25-
- name: Get version for branch
26-
id: get_branch_version
27-
run: echo ::set-output name=BRANCH_VERSION::${GITHUB_REF/refs\/tags\/offline-/}
28-
shell: bash
20+
uses: actions/checkout@v4
21+
2922
- name: Set up Python 3.11
30-
uses: actions/setup-python@v4
23+
uses: actions/setup-python@v5
3124
with:
3225
python-version: '3.11'
26+
3327
- name: Install Inno Setup Download plugin
3428
shell: pwsh
3529
run: Invoke-WebRequest -Uri https://github.com/espressif/inno-download-plugin/releases/download/v1.5.1/idpsetup-1.5.1.exe -OutFile idpsetup.exe; .\idpsetup.exe /SILENT; Sleep 5
30+
3631
- name: Build Installer
3732
env:
3833
CERTIFICATE: ${{ secrets.CERTIFICATE }}
3934
CERTIFICATE_PASSWORD: ${{ secrets.CERTIFICATE_PASSWORD }}
4035
shell: pwsh
41-
run: .\Build-Installer.ps1 -InstallerType offline -OfflineBranch v${{ steps.get_branch_version.outputs.BRANCH_VERSION }}
36+
run: .\Build-Installer.ps1 -InstallerType offline -OfflineBranch v${{ env.IDF_BRANCH }}
37+
4238
- name: Create Release
4339
id: create_release
4440
uses: actions/create-release@v1
4541
env:
4642
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4743
with:
48-
tag_name: ${{ github.ref }}
49-
release_name: Release ${{ github.ref }}
44+
tag_name: ${{ env.VERSION }}-esp-idf-v${{ env.IDF_BRANCH }}
45+
release_name: Release ${{ env.VERSION }}
5046
draft: false
5147
prerelease: false
48+
49+
- name: Get installer size and store it to file
50+
run: |
51+
echo $(Get-ItemProperty -Path .\build\esp-idf-tools-setup-offline-signed.exe | Select-Object -ExpandProperty Length) > variables.txt
52+
echo "Instaler size from variable is $(Get-Content variables.txt)"
53+
54+
- name: Upload artifacts of installer size
55+
uses: actions/upload-artifact@v4
56+
with:
57+
name: installer-size
58+
path: ./variables.txt
59+
5260
- name: Upload Release Asset To Github
5361
id: upload-release-asset
5462
uses: actions/upload-release-asset@v1
@@ -57,13 +65,14 @@ jobs:
5765
with:
5866
upload_url: ${{ steps.create_release.outputs.upload_url }}
5967
asset_path: ./build/esp-idf-tools-setup-offline-signed.exe
60-
asset_name: esp-idf-tools-setup-${{ steps.get_version.outputs.VERSION }}.exe
68+
asset_name: esp-idf-tools-setup-${{ env.VERSION }}.exe
6169
asset_content_type: application/octet-stream
70+
6271
- name: Upload Release Asset To dl.espressif.com
6372
id: upload-release-asset-espressif
6473
env:
6574
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
6675
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
6776
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }}
6877
shell: pwsh
69-
run: aws s3 cp --acl=public-read --no-progress ./build/esp-idf-tools-setup-offline-signed.exe s3://${{ secrets.DL_BUCKET }}/dl/idf-installer/esp-idf-tools-setup-${{ steps.get_version.outputs.VERSION }}.exe
78+
run: aws s3 cp --acl=public-read --no-progress ./build/esp-idf-tools-setup-offline-signed.exe s3://${{ secrets.DL_BUCKET }}/dl/idf-installer/esp-idf-tools-setup-${{ env.VERSION }}.exe
Lines changed: 28 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,56 @@
11
name: build-online-installer
22

33
on:
4-
push:
5-
tags:
6-
- online-*
4+
workflow_call:
5+
inputs:
6+
online_installer_version:
7+
required: true
8+
type: string
9+
10+
env:
11+
VERSION: 'online-${{ inputs.online_installer_version }}'
712

813
jobs:
914
build-online-installer:
1015
name: Build Installer
1116
runs-on: windows-latest
1217
steps:
1318
- name: Checkout repository
14-
uses: actions/checkout@v3
15-
- name: Get the version
16-
id: get_version
17-
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
18-
shell: bash
19-
- name: Get the installer type
20-
id: get_installer_type
21-
run: echo ::set-output name=INSTALLER_TYPE::${${{ steps.get_version.outputs.VERSION }}//-*}
22-
shell: bash
19+
uses: actions/checkout@v4
20+
2321
- name: Install Inno Setup Download plugin
2422
shell: pwsh
2523
run: ./src/PowerShell/Install-IdpSetup.ps1
24+
2625
- name: Build Installer
2726
env:
2827
CERTIFICATE: ${{ secrets.CERTIFICATE }}
2928
CERTIFICATE_PASSWORD: ${{ secrets.CERTIFICATE_PASSWORD }}
3029
shell: pwsh
3130
run: .\Build-Installer.ps1 -InstallerType online
31+
3232
- name: Create Release
3333
id: create_release
3434
uses: actions/create-release@v1
3535
env:
3636
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3737
with:
38-
tag_name: ${{ github.ref }}
39-
release_name: Release ${{ github.ref }}
38+
tag_name: ${{ env.VERSION }}
39+
release_name: Release ${{ env.VERSION }}
4040
draft: false
4141
prerelease: false
42+
43+
- name: Get installer size and store it to file
44+
run: |
45+
echo $(Get-ItemProperty -Path .\build\esp-idf-tools-setup-online-signed.exe | Select-Object -ExpandProperty Length) > variables.txt
46+
echo "Instaler size from variable is $(Get-Content variables.txt)"
47+
48+
- name: Upload artifacts of installer size
49+
uses: actions/upload-artifact@v4
50+
with:
51+
name: installer-size
52+
path: ./variables.txt
53+
4254
- name: Upload Release Asset To Github
4355
id: upload-release-asset
4456
uses: actions/upload-release-asset@v1
@@ -47,7 +59,7 @@ jobs:
4759
with:
4860
upload_url: ${{ steps.create_release.outputs.upload_url }}
4961
asset_path: ./build/esp-idf-tools-setup-online-signed.exe
50-
asset_name: esp-idf-tools-setup-${{ steps.get_version.outputs.VERSION }}.exe
62+
asset_name: esp-idf-tools-setup-${{ env.VERSION }}.exe
5163
asset_content_type: application/octet-stream
5264
- name: Upload Release Asset To dl.espressif.com
5365
id: upload-release-asset-espressif
@@ -56,4 +68,4 @@ jobs:
5668
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
5769
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }}
5870
shell: pwsh
59-
run: aws s3 cp --acl=public-read --no-progress ./build/esp-idf-tools-setup-online-signed.exe s3://${{ secrets.DL_BUCKET }}/dl/idf-installer/esp-idf-tools-setup-${{ steps.get_version.outputs.VERSION }}.exe
71+
run: aws s3 cp --acl=public-read --no-progress ./build/esp-idf-tools-setup-online-signed.exe s3://${{ secrets.DL_BUCKET }}/dl/idf-installer/esp-idf-tools-setup-${{ env.VERSION }}.exe

0 commit comments

Comments
 (0)