Skip to content

Release 3.7 (03.03.2024) #11

Release 3.7 (03.03.2024)

Release 3.7 (03.03.2024) #11

Workflow file for this run

name: 🚀 Release Firmware
on:
workflow_dispatch:
inputs:
release-version:
description: 'Release version'
required: true
type: string
release-title:
description: 'Release title'
required: true
type: string
run-name: Release ${{ inputs.release-version }} (${{ inputs.release-title }})
jobs:
release_firmware:
if: ${{ github.ref_name == 'master' }}
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Replace version in firmware source
run: |
sed -i 's/VERSION = ".*";/VERSION = "${{ inputs.release-version }}";/' ${{ github.workspace }}/src/firmware/firmware.ino
- name: Compile firmware
uses: ./.github/workflows/firmware-compile
- name: Copy release files to bin folder
run: |
mkdir -p ${{ github.workspace }}/bin/
mkdir -p ${{ github.workspace }}/bin_beta/
cp -f ${{ github.workspace }}/src/firmware/build/esp32.esp32.esp32/firmware.ino.bin ${{ github.workspace }}/bin/${{ inputs.release-version }}.bin
cp -f ${{ github.workspace }}/src/firmware/build/esp32.esp32.esp32/firmware.ino.bin ${{ github.workspace }}/bin/latest.bin
cp -f ${{ github.workspace }}/src/firmware/build/esp32.esp32.esp32/firmware.ino.bin ${{ github.workspace }}/bin_beta/${{ inputs.release-version }}.bin
cp -f ${{ github.workspace }}/src/firmware/build/esp32.esp32.esp32/firmware.ino.bin ${{ github.workspace }}/bin_beta/latest_beta.bin
- name: Leave only 3 recent releases
run: |
cd ${{ github.workspace }}/bin/
ls -tp | grep -v '/$' | tail -n +5 | xargs -I {} rm -- {}
cd ${{ github.workspace }}/bin_beta/
ls -tp | grep -v '/$' | tail -n +5 | xargs -I {} rm -- {}
cd ${{ github.workspace }}
- name: Commit changes
id: commit_changes
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "Release ${{ inputs.release-version }}"
file_pattern: ${{ github.workspace }}/src/firmware/firmware.ino ${{ github.workspace }}/bin/ ${{ github.workspace }}/bin_beta/
- name: Create Release
uses: ncipollo/release-action@v1
with:
artifacts: ${{ github.workspace }}/bin/${{ inputs.release-version }}.bin
name: "${{ inputs.release-version }}: ${{ inputs.release-title }}"
commit: ${{ steps.commit_changes.outputs.commit_hash }}
tag: ${{ inputs.release-version }}
generateReleaseNotes: true
allowUpdates: true
makeLatest: true
- name: Merge master -> develop
uses: devmasx/merge-branch@master
with:
type: now
target_branch: develop
head_to_merge: ${{ steps.commit_changes.outputs.commit_hash }}
message: Sync Release ${{ inputs.release-version }} to develop
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Update server bin list
uses: appleboy/[email protected]
with:
host: ${{ secrets.SERVER_IP }}
username: ${{ secrets.SERVER_SSH_USER }}
password: ${{ secrets.SERVER_SSH_PASSWORD }}
script: |
cd /root/ukraine_alarm_map/deploy/
git fetch --all
git checkout master
git pull
bash redeploy_update_server.sh -s '/root/ukraine_alarm_map/bin' -sb '/root/ukraine_alarm_map/bin_beta' -m ${{ secrets.MEMCACHED_HOST }}