Create release using Github Actions manual dispatch (#428)
This commit is contained in:
96
.github/workflows/build.yml
vendored
96
.github/workflows/build.yml
vendored
@@ -94,98 +94,4 @@ jobs:
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: ${{ format('{0}-{1}-assets', env.VARIANT, matrix.build) }}
|
||||
path: ${{ matrix.build }}/${{ env.VARIANT }}
|
||||
release:
|
||||
name: Release new version
|
||||
needs: build
|
||||
runs-on: ubuntu-latest
|
||||
if: startsWith(github.ref, 'refs/tags')
|
||||
steps:
|
||||
- name: Get the version
|
||||
id: get_version
|
||||
run: echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT
|
||||
- name: Git Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: ${{ github.head_ref }}
|
||||
- name: Download release assets
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
path: release
|
||||
pattern: '*-release-assets'
|
||||
- name: Download debug assets
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
path: debug
|
||||
pattern: '*-debug-assets'
|
||||
- name: Build zip archives
|
||||
id: zip
|
||||
env:
|
||||
VERSION: ${{ steps.get_version.outputs.VERSION }}
|
||||
run: |
|
||||
NUKI="NukiHub-${VERSION}"
|
||||
ARTIFACTS=""
|
||||
|
||||
for FOLDER in release/*; do
|
||||
MODEL=`echo "${FOLDER}" | cut -d '/' -f2 | cut -d '-' -f1 | tr '[:lower:]' '[:upper:]'`
|
||||
ZIPFILE="${NUKI}-${MODEL}.zip"
|
||||
|
||||
echo "${FOLDER} -- ${ZIPFILE}"
|
||||
cd $FOLDER
|
||||
|
||||
zip -9r ../../${ZIPFILE} * -x "webflash_nuki_hub_*.bin"
|
||||
ARTIFACTS="${ARTIFACTS}${ZIPFILE},"
|
||||
|
||||
cd ../..
|
||||
done
|
||||
|
||||
for FOLDER in debug/*; do
|
||||
MODEL=`echo "${FOLDER}" | cut -d '/' -f2 | cut -d '-' -f1 | tr '[:lower:]' '[:upper:]'`
|
||||
ZIPFILE="${NUKI}-${MODEL}-DEBUG.zip"
|
||||
|
||||
echo "${FOLDER} -- ${ZIPFILE}"
|
||||
cd $FOLDER
|
||||
|
||||
zip -9r ../../${ZIPFILE} *
|
||||
ARTIFACTS="${ARTIFACTS}${ZIPFILE},"
|
||||
|
||||
cd ../..
|
||||
done
|
||||
|
||||
# remove last character
|
||||
ARTIFACTS="${ARTIFACTS%?}"
|
||||
echo "artifacts=${ARTIFACTS}" | tee -a ${GITHUB_OUTPUT}
|
||||
- name: Create Release
|
||||
id: create_release
|
||||
uses: ncipollo/release-action@v1
|
||||
with:
|
||||
prerelease: false
|
||||
allowUpdates: true
|
||||
updateOnlyUnreleased: false
|
||||
draft: true
|
||||
name: "Nuki Hub ${{ steps.get_version.outputs.VERSION }}"
|
||||
artifacts: ${{ steps.zip.outputs.artifacts }}
|
||||
artifactContentType: application/zip
|
||||
- name: Copy binaries to ota and webflash and remove beta
|
||||
env:
|
||||
Version: ${{ github.run_id }}.${{ github.run_number }}.${{ github.run_attempt }}
|
||||
run: |
|
||||
cp -vf release/*/nuki_hub_*.bin ota/
|
||||
cp -vf release/*/webflash_nuki_hub_*.bin webflash/
|
||||
rm -rf release
|
||||
rm -rf debug
|
||||
rm -rf NukiHub-*.zip
|
||||
git rm -r --cached ota/beta/*.bin
|
||||
python3 resources/ota_manifest.py release $Version
|
||||
python3 resources/ota_manifest.py beta none
|
||||
- name: Commit binaries to master
|
||||
uses: stefanzweifel/git-auto-commit-action@v5
|
||||
with:
|
||||
commit_message: "Update binaries for version ${{ steps.get_version.outputs.VERSION }}"
|
||||
file_pattern: 'ota/*.bin ota/manifest.json ota/beta/*.bin webflash/*.bin'
|
||||
branch: master
|
||||
skip_dirty_check: true
|
||||
skip_fetch: true
|
||||
skip_checkout: true
|
||||
disable_globbing: true
|
||||
add_options: '-f'
|
||||
path: ${{ matrix.build }}/${{ env.VARIANT }}
|
||||
Reference in New Issue
Block a user