-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #222 from espressif/feat/automatic_installer_release
Feat/automatic installer release
- Loading branch information
Showing
9 changed files
with
700 additions
and
159 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,79 +1,92 @@ | ||
name: build-espressif-ide-installer | ||
|
||
on: | ||
workflow_dispatch: | ||
workflow_call: | ||
inputs: | ||
espressif_ide_version: | ||
description: 'Espressif IDE version' | ||
required: true | ||
default: '2.9.1' | ||
esp_idf_version: | ||
description: 'ESP-IDF version' | ||
required: true | ||
default: '5.0.1' | ||
python_version: | ||
description: 'Python version' | ||
type: string | ||
espressif_ide_version: | ||
required: true | ||
default: '3.11' | ||
type: string | ||
|
||
jobs: | ||
build-espressif-ide-installer: | ||
name: Build Installer | ||
runs-on: windows-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
uses: actions/checkout@v4 | ||
|
||
- name: Inputs Logged | ||
run: | | ||
echo "Received Espressif IDE Version: ${{ github.event.inputs.espressif_ide_version }}" | ||
echo "Received ESP-IDF Version: ${{ github.event.inputs.esp_idf_version }}" | ||
echo "Received Python Version: ${{ github.event.inputs.python_version }}" | ||
- name: Map local long path to new drive | ||
id: map_path | ||
shell: pwsh | ||
run: subst "p:" "$env:GITHUB_WORKSPACE" | ||
|
||
- name: Install Inno Setup | ||
shell: pwsh | ||
run: choco install innosetup | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '${{ github.event.inputs.python_version }}' | ||
python-version: '3.11' | ||
|
||
- name: Install Inno Setup Download plugin | ||
shell: pwsh | ||
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 | ||
|
||
- name: Build Installer | ||
env: | ||
CERTIFICATE: ${{ secrets.CERTIFICATE }} | ||
CERTIFICATE_PASSWORD: ${{ secrets.CERTIFICATE_PASSWORD }} | ||
shell: pwsh | ||
working-directory: "P:" | ||
run: .\Build-Installer.ps1 -InstallerType espressif-ide -OfflineBranch "v${{ github.event.inputs.esp_idf_version }}" -EspressifIdeVersion "${{ github.event.inputs.espressif_ide_version }}" | ||
run: .\Build-Installer.ps1 -InstallerType espressif-ide -OfflineBranch "v${{ inputs.esp_idf_version }}" -EspressifIdeVersion "${{ inputs.espressif_ide_version }}" | ||
|
||
- name: Create Release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: espressif-ide-${{ github.event.inputs.espressif_ide_version }}-esp-idf-${{ github.event.inputs.esp_idf_version }} | ||
release_name: Release of Espressif IDE ${{ github.event.inputs.espressif_ide_version }} with ESP-IDF ${{ github.event.inputs.esp_idf_version }} | ||
tag_name: espressif-ide-${{ inputs.espressif_ide_version }}-esp-idf-${{ inputs.esp_idf_version }} | ||
release_name: Release of Espressif IDE ${{ inputs.espressif_ide_version }} with ESP-IDF ${{ inputs.esp_idf_version }} | ||
draft: true | ||
prerelease: true | ||
|
||
- name: Get installer size and store it to file | ||
run: | | ||
echo $(Get-ItemProperty -Path .\build\espressif-ide-setup-espressif-ide-with-esp-idf-${{ inputs.esp_idf_version }}-signed.exe | Select-Object -ExpandProperty Length) > variables.txt | ||
echo "Instaler size from variable is $(Get-Content variables.txt)" | ||
- name: Upload artifacts of installer size | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: installer-size | ||
path: ./variables.txt | ||
|
||
- name: Upload Release Asset To Github | ||
id: upload-release-asset | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} | ||
asset_path: ./build/espressif-ide-setup-espressif-ide-with-esp-idf-${{ github.event.inputs.esp_idf_version }}-signed.exe | ||
asset_name: espressif-ide-setup-${{ github.event.inputs.espressif_ide_version }}-with-esp-idf-${{ github.event.inputs.esp_idf_version }}.exe | ||
asset_path: ./build/espressif-ide-setup-espressif-ide-with-esp-idf-${{ inputs.esp_idf_version }}-signed.exe | ||
asset_name: espressif-ide-setup-${{ inputs.espressif_ide_version }}-with-esp-idf-${{ inputs.esp_idf_version }}.exe | ||
asset_content_type: application/octet-stream | ||
|
||
- name: Upload Release Asset To dl.espressif.com | ||
id: upload-release-asset-espressif | ||
env: | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }} | ||
shell: pwsh | ||
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 | ||
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 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
name: build-installer-any | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
installer_type: | ||
type: choice | ||
description: 'Installer Type' | ||
required: true | ||
options: | ||
- offline | ||
- espressif-ide | ||
- online | ||
esp_idf_version: | ||
description: 'ESP-IDF version (e.g. 5.2 or 5.2.1)' | ||
required: false | ||
default: '' | ||
espressif_ide_version: | ||
description: 'Espressif IDE version (e.g. 2.0.0)' | ||
required: false | ||
default: '' | ||
online_installer_version: | ||
description: 'Online Installer version (e.g. 2.0)' | ||
required: false | ||
default: '' | ||
|
||
env: | ||
INSTALLER_TYPE: ${{ inputs.installer_type }} | ||
ESP_IDF_VERSION: ${{ inputs.esp_idf_version }} | ||
ESPRESSIF_IDE_VERSION: ${{ inputs.espressif_ide_version }} | ||
ONLINE_INSTALLER_VERSION: ${{ inputs.online_installer_version }} | ||
# Based on this defined supported IDF versions are created installer buttons in index.html from releases.json | ||
SUPPORTED_IDF_VERSIONS: ('5.2', '4.4', '5.1', '5.0') | ||
|
||
jobs: | ||
build-installer-online: | ||
name: Build Online Installer | ||
if: ${{ inputs.installer_type }} == 'online' | ||
uses: espressif/idf-installer/.github/workflows/build-online-installer.yml@main | ||
with: | ||
online_installer_version: ${{ inputs.online_installer_version }} | ||
secrets: inherit | ||
|
||
build-installer-offline: | ||
name: Build Offline Installer | ||
if: ${{ inputs.installer_type }} == 'offline' | ||
uses: espressif/idf-installer/.github/workflows/build-offline-installer.yml@main | ||
with: | ||
esp_idf_version: ${{ inputs.esp_idf_version}} | ||
secrets: inherit | ||
|
||
build-installer-ide: | ||
name: Build IDE Installer | ||
if: ${{ inputs.installer_type }} == 'espressif-ide' | ||
uses: espressif/idf-installer/.github/workflows/build-espressif-ide-installer.yml@main | ||
with: | ||
esp_idf_version: ${{ inputs.esp_idf_version }} | ||
espressif_ide_version: ${{ inputs.espressif_ide_version }} | ||
secrets: inherit | ||
|
||
update-docs-files: | ||
needs: [build-installer-online, build-installer-offline, build-installer-ide] | ||
name: Create ${{ inputs.installer_type}} installer release PR | ||
if: ${{ always() }} && (${{ needs.build-installer-ide.result }} == 'success' || ${{ needs.build-installer-offline.result }} == 'success' || ${{ needs.build-installer-online.result }} == 'success') | ||
runs-on: windows-latest | ||
strategy: | ||
fail-fast: false | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.11' | ||
|
||
- name: Download artifacts | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: installer-size | ||
path: ./ | ||
|
||
- name: Install script requirements | ||
run: pip install -r scripts/requirements.txt | ||
|
||
- name: Get size of online installer and Update docs files | ||
run: | | ||
echo "Instaler size from variable is $(Get-Content variables.txt)" | ||
$size_bytes = [int]$(Get-Content variables.txt) | ||
# Check if the content is larger than 100000 | ||
if ($size_bytes -gt 9999999) { | ||
$result = [math]::Round($size_bytes / 1000000000,2) | ||
$installer_size = "$result GB" | ||
echo "INSTALLER_SIZE: $installer_size" | ||
} else { | ||
$result = [math]::Round($size_bytes / 1000000,2) | ||
$installer_size = "$result MB" | ||
echo "INSTALLER_SIZE: $installer_size" | ||
} | ||
python scripts/docs_update_release.py $installer_size | ||
- name: Delete variables.txt | ||
run: | | ||
Remove-Item -Path variables.txt -Force | ||
- name: Put current date into a variable | ||
run: | | ||
$DATE=& Get-Date -format yyyy-MM-dd | ||
echo "DATE=$DATE" >> $env:GITHUB_ENV | ||
- name: Create Pull Request | ||
uses: peter-evans/create-pull-request@v6 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
commit-message: 'Release ${{ env.INSTALLER_TYPE }} installer ${{env.ESPRESSIF_IDE_VERSION}}${{env.ONLINE_INSTALLER_VERSION}} with ESP-IDF v${{ env.ESP_IDF_VERSION }}' | ||
title: 'Release ${{ env.INSTALLER_TYPE }} installer ${{env.ESPRESSIF_IDE_VERSION}}${{env.ONLINE_INSTALLER_VERSION}} with ESP-IDF v${{ env.ESP_IDF_VERSION }}' | ||
body: '- Updated docs files' | ||
branch: 'release-${{ env.INSTALLER_TYPE }}${{ env.ESP_IDF_VERSION }}-installer' | ||
delete-branch: true | ||
base: 'main' | ||
reviewers: georgik, jakub-kocka |
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
Oops, something went wrong.