Skip to content

Commit

Permalink
Add tagged release support
Browse files Browse the repository at this point in the history
  • Loading branch information
forkineye committed Sep 26, 2021
1 parent df04394 commit 82829a7
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 163 deletions.
122 changes: 0 additions & 122 deletions .ci/firmware.json

This file was deleted.

57 changes: 29 additions & 28 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,10 @@ jobs:
mkdir firmware
echo "CI-$GITHUB_RUN_ID" > firmware/VERSION
- name: Tagged release
if: startsWith(github.ref, 'refs/tags/')
- name: Tagged version release
if: startsWith(github.ref, 'refs/tags/v')
run: |
echo "${{ github.ref }}" > firmware/VERSION
echo "ESPS_RELEASE" >> $GITHUB_ENV
echo "${GITHUB_REF#refs/*/v}" > firmware/VERSION
- name: Create secrets.h
run: |
Expand Down Expand Up @@ -85,23 +84,17 @@ jobs:


package:
name: Create Package
needs: firmware
runs-on: ubuntu-latest
steps:
# Set Release Archive Filename
# - run: |
# if [ -z "$ESPS_RELEASE" ]; then
# echo "ARCHFILE=ESPixelStick_CI-$GITHUB_RUN_ID.zip" >> $GITHUB_ENV
# else
# echo "ARCHFILE=ESPixelStick_Firmware-$ESPS_RELEASE.zip" >> $GITHUB_ENV
# fi

# Checkout ESPixelStick
- uses: actions/checkout@v2

- name: Tagged release
if: startsWith(github.ref, 'refs/tags/')
run: echo "ESPS_RELEASE" >> $GITHUB_ENV
- name: Set release flag
if: startsWith(github.ref, 'refs/tags/v')
run: |
echo "ESPS_RELEASE=''" >> $GITHUB_ENV
# Download firmware binary artifact
- uses: actions/download-artifact@v2
Expand All @@ -120,21 +113,19 @@ jobs:
run: |
gulp
gulp md
if [ -z "$ESPS_RELEASE" ]; then
gulp ci
fi
mv ESPixelStick/data/* dist/fs
- name: Set release archive filename
run: echo "ARCHFILE=ESPixelStick_Firmware-`cat dist/firmware/VERSION`.zip" >> $GITHUB_ENV
run: |
_VERSION=$(< dist/firmware/VERSION)
echo "ARCHFILE=ESPixelStick_Firmware-${_VERSION}.zip" >> $GITHUB_ENV
- name: Update firmware.json
run: python .scripts/ci-firmware.py

- name: Move CI specific release files into place
run: |
if [ -z "$ESPS_RELEASE" ]; then
mv .ci/firmware.json dist/firmware/firmware.json
fi
- name: Create Release Archive
run: zip -r ../${{ env.ARCHFILE }} *
working-directory: dist
Expand All @@ -144,9 +135,19 @@ jobs:
with:
name: Release Archive
path: ${{ env.ARCHFILE }}

# - name: Release
# uses: softprops/action-gh-release@v1
# if: startsWith(github.ref, 'refs/tags/')
# with:
# files: ${{ env.ARCHFILE }}

release:
needs: package
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
steps:
- name: Download Package
uses: actions/download-artifact@v2
with:
name: Release Archive
- name: Create Draft Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
draft: true
files: ESPixelStick_Firmware*.zip
21 changes: 8 additions & 13 deletions .scripts/ci-firmware.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,12 @@
version = file.readline().rstrip()
file.close

if RELEASE in os.environ:
with open("dist/firmware.json", "r+") as file:
data = json.load(file)
with open("dist/firmware/firmware.json", "r+") as file:
data = json.load(file)
if RELEASE in os.environ:
data["release"] = f"ESPixelStick {version}"
file.seek(0)
json.dump(data, file)
file.truncate()
else:
with open(".ci/firmware.json", "r+") as file:
data = json.load(file)
data["release"] = f"ESPixelStick CI Build #{version}"
file.seek(0)
json.dump(data, file)
file.truncate()
else:
data["release"] = f"ESPixelStick Build #{version} (untested)"
file.seek(0)
json.dump(data, file)
file.truncate()

0 comments on commit 82829a7

Please sign in to comment.