Skip to content

Release V2.2

Release V2.2 #32

Workflow file for this run

name: Release V2.1
on:
push:
tags:
- 'v*'
workflow_dispatch:
jobs:
# get_default_envs:
# name: Gather Environments
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v2
# - uses: actions/setup-python@v2
# - name: Install PlatformIO
# run: |
# pip install -U platformio
# platformio update
# - name: Dump github context
# run: echo "$GITHUB_CONTEXT"
# shell: bash
# env:
# GITHUB_CONTEXT: ${{ toJson(github) }}
# - name: Get default environments
# id: envs
# run: |
# echo "::set-output name=environments::$(pio project config --json-output | jq -cr '.[0][1][0][1]')"
# echo ${{ steps.envs.outputs.environments }}
# outputs:
# environments: ${{ steps.envs.outputs.environments }}
build:
name: Create Release
runs-on: ubuntu-latest
# needs: get_default_envs
strategy:
matrix:
# environment: ${{ fromJSON(needs.get_default_envs.outputs.environments) }}
environment: [TTGO_TDISPLAY, TTGO_TDISPLAY_SANDWICH, esp32dev_OLED, esp32dev_OLED_OTA]
# environment: [TTGO_TDISPLAY_SANDWICH]
# environment: [esp32dev, esp32dev-sandwich]
# environment: [esp32dev-sandwich]
timeout-minutes: 15 # time out after 15 minutes (default is 360 minutes)
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Show enviroments
run: |
echo
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -U platformio
pio pkg update
- name: Get the version
id: get_version
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
- name: Show version
run: echo ${{ steps.get_version.outputs.VERSION }}
- name: Get current date
id: date
run: |
echo "date=$(date +'%d-%m-%Y')" >> $GITHUB_OUTPUT
echo "time=$(date +'%H:%M:%S')" >> $GITHUB_OUTPUT
- name: Create manifest file
id: createmanifest
run: |
# Create manifest
echo "{" > CO2-Gadget-TTGO_TDISPLAY_SANDWICH.manifest.json
echo " \"name\": \"CO2-Gadget-TTGO_TDISPLAY_SANDWICH\"," >> CO2-Gadget-TTGO_TDISPLAY_SANDWICH.manifest.json
echo " \"version\": \"refs/heads/master\"," >> CO2-Gadget-TTGO_TDISPLAY_SANDWICH.manifest.json
echo " \"compilation_date\": \"07-01-2024\"," >> CO2-Gadget-TTGO_TDISPLAY_SANDWICH.manifest.json
echo " \"compilation_time\": \"13:27:19\"," >> CO2-Gadget-TTGO_TDISPLAY_SANDWICH.manifest.json
echo " \"new_install_prompt_erase\": true," >> CO2-Gadget-TTGO_TDISPLAY_SANDWICH.manifest.json
echo " \"new_install_improv_wait_time\": 0," >> CO2-Gadget-TTGO_TDISPLAY_SANDWICH.manifest.json
echo " \"builds\": [" >> CO2-Gadget-TTGO_TDISPLAY_SANDWICH.manifest.json
echo " {" >> CO2-Gadget-TTGO_TDISPLAY_SANDWICH.manifest.json
echo " \"chipFamily\": \"ESP32\"," >> CO2-Gadget-TTGO_TDISPLAY_SANDWICH.manifest.json
echo " \"improv\": false," >> CO2-Gadget-TTGO_TDISPLAY_SANDWICH.manifest.json
echo " \"parts\": [" >> CO2-Gadget-TTGO_TDISPLAY_SANDWICH.manifest.json
echo " { \"path\": \"CO2-Gadget-TTGO_TDISPLAY_SANDWICH-refs/heads/master-bootloader.bin\", \"offset\": 4096 }," >> CO2-Gadget-TTGO_TDISPLAY_SANDWICH.manifest.json
echo " { \"path\": \"CO2-Gadget-TTGO_TDISPLAY_SANDWICH-refs/heads/master-partitions.bin\", \"offset\": 32768 }," >> CO2-Gadget-TTGO_TDISPLAY_SANDWICH.manifest.json
echo " { \"path\": \"boot_app0.bin\", \"offset\": 57344 }," >> CO2-Gadget-TTGO_TDISPLAY_SANDWICH.manifest.json
echo " { \"path\": \"CO2-Gadget-TTGO_TDISPLAY_SANDWICH-refs/heads/master-firmware.bin\", \"offset\": 65536 }," >> CO2-Gadget-TTGO_TDISPLAY_SANDWICH.manifest.json
echo " { \"path\": \"CO2-Gadget-TTGO_TDISPLAY_SANDWICH-refs/heads/master-spiffs.bin\", \"offset\": 3997696 }" >> CO2-Gadget-TTGO_TDISPLAY_SANDWICH.manifest.json
echo " ]" >> CO2-Gadget-TTGO_TDISPLAY_SANDWICH.manifest.json
echo " }" >> CO2-Gadget-TTGO_TDISPLAY_SANDWICH.manifest.json
echo " ]" >> CO2-Gadget-TTGO_TDISPLAY_SANDWICH.manifest.json
echo "}" >> CO2-Gadget-TTGO_TDISPLAY_SANDWICH.manifest.json
echo "manifest=$(cat CO2-Gadget-TTGO_TDISPLAY_SANDWICH.manifest.json)" >> $GITHUB_OUTPUT
- name: Read manifest files
run: |
echo "Manifest file contents readed with cat:"
cat ${{ github.event.repository.name }}-${{ matrix.environment }}.manifest.json
- name: Copy manifest files
if: startsWith(github.ref, 'refs/tags/')
run: |
mkdir ./firmware
cp ${{ github.event.repository.name }}-${{ matrix.environment }}.manifest.json ./firmware/${{ github.event.repository.name }}-${{ matrix.environment }}.manifest.json
- name: Build firmware file
run: |
pio run -e ${{ matrix.environment }}
- name: Copy firmware files
if: startsWith(github.ref, 'refs/tags/')
run: |
cp ~/.platformio/packages/framework-arduinoespressif32/tools/sdk/bin/bootloader_dio_40m.bin ./firmware/${{ github.event.repository.name }}-${{ matrix.environment }}-${{ steps.get_version.outputs.VERSION }}-bootloader.bin
cp .pio/build/${{ matrix.environment }}/partitions.bin ./firmware/${{ github.event.repository.name }}-${{ matrix.environment }}-${{ steps.get_version.outputs.VERSION }}-partitions.bin
cp .pio/build/${{ matrix.environment }}/firmware.bin ./firmware/${{ github.event.repository.name }}-${{ matrix.environment }}-${{ steps.get_version.outputs.VERSION }}-firmware.bin
- name: Build spiffs file
run: |
pio run -e ${{ matrix.environment }} -t buildfs
- name: Copy spiffs files
if: startsWith(github.ref, 'refs/tags/')
run: |
ls -la ./firmware
cp .pio/build/${{ matrix.environment }}/spiffs.bin ./firmware/${{ github.event.repository.name }}-${{ matrix.environment }}-${{ steps.get_version.outputs.VERSION }}-spiffs.bin
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
name: ${{ github.event.repository.name }}-${{ steps.get_version.outputs.VERSION }}
files: |
./firmware/*.bin
./firmware/*.json
draft: true
# prerelease: true
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_ACTION_TOKEN }}
- name: 📂 Sync files - FTP-Deploy-Action
uses: SamKirkland/FTP-Deploy-Action@2.0.0
env:
FTP_SERVER: ${{ secrets.FTP_SERVER }}
FTP_USERNAME: ${{ secrets.FTP_USER }}
FTP_PASSWORD: ${{ secrets.FTP_PASSWORD }}
LOCAL_DIR: ./firmware/
REMOTE_DIR: /${{ github.event.repository.name }}/
METHOD: ftp
PORT: 21
ARGS: --verbose
- name: Clean WP Rocket Cache
run: curl https://emariete.com/clean_cache.php