Skip to content

Commit

Permalink
ci: consistent variable names
Browse files Browse the repository at this point in the history
also fix invalid last -> last_tag
  • Loading branch information
mcspr committed Jan 15, 2025
1 parent db17193 commit 00bfa64
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .github/release_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ When updating from 1.14.1 make sure **there is enough available space on the dev

Make sure to **only** perform OTA upgrade with a properly powered device. Attempting to flash and / or use a normally AC powered device (like a Sonoff) instead powered through 3v3 **may** result in unexpected issues with the firmware.

# Snapshot build $$DATE$$
# Snapshot build

**How to upgrade "over-the-air" aka OTA**: https://github.com/xoseperez/espurna/wiki/OTA
**Latest changes**: https://github.com/xoseperez/espurna/compare/$$LAST_TAG$$...$$BUILD_TAG$$
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Release (test)
name: Preview release template

on:
workflow_dispatch:
Expand All @@ -7,18 +7,18 @@ jobs:
variables:
runs-on: ubuntu-latest
outputs:
build_date: ${{ steps.result.outputs.build_date }}
build_tag: ${{ steps.result.outputs.build_tag }}
date: ${{ steps.result.outputs.date }}
dev: ${{ steps.result.outputs.dev }}
last_tag: ${{ steps.result.outputs.last }}
last_rev: ${{ steps.result.outputs.last_rev }}
last_tag: ${{ steps.result.outputs.last_tag }}

steps:
- name: Prepare version variables
id: result
shell: bash
run: |
remote_last_tag() {
git ls-remote --tags --sort='version:refname' https://github.com/xoseperez/espurna 'github*' |\
git ls-remote --tags --sort='version:refname' https://github.com/xoseperez/espurna.git 'github*' |\
cut -d'/' -f3 |\
grep -o -E '^github[0-9]{6}$' |\
sort -r |\
Expand All @@ -30,17 +30,17 @@ jobs:
}
date=$(date +'%y%m%d')
echo "date=${date}" >> "$GITHUB_OUTPUT"
echo "build_date=${date}" >> "$GITHUB_OUTPUT"
tag="github${date}"
echo "build_tag=${tag}" >> "$GITHUB_OUTPUT"
dev=$(remote_revision dev)
echo "dev=${dev}" >> "$GITHUB_OUTPUT"
echo "last_rev=${dev}" >> "$GITHUB_OUTPUT"
last=$(remote_last_tag)
echo "last_tag=${last}" >> "$GITHUB_OUTPUT"
build="github${date}"
echo "build_tag=${build}" >> "$GITHUB_OUTPUT"
release:
needs: variables
runs-on: ubuntu-latest
Expand All @@ -55,9 +55,13 @@ jobs:
- name: Render release template
run: |
echo "build_date=" ${{ needs.variables.outputs.build_date }}
echo "build_tag=" ${{ needs.variables.outputs.build_tag }}
echo "last_rev=" ${{ needs.variables.outputs.last_rev }}
echo "last_tag=" ${{ needs.variables.outputs.last_tag }}
sed \
-i \
-e 's/\$\$DATE\$\$/'${{ needs.variables.outputs.date }}'/g' \
-e 's/\$\$BUILD_TAG\$\$/'${{ needs.variables.outputs.build_tag }}'/g' \
-e 's/\$\$LAST_TAG\$\$/'${{ needs.variables.outputs.last_tag }}'/g' \
release_template.md
Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ jobs:
variables:
runs-on: ubuntu-latest
outputs:
build_date: ${{ steps.result.outputs.build_date }}
build_tag: ${{ steps.result.outputs.build_tag }}
date: ${{ steps.result.outputs.date }}
dev: ${{ steps.result.outputs.dev }}
last_tag: ${{ steps.result.outputs.last }}
last_rev: ${{ steps.result.outputs.last_rev }}
last_tag: ${{ steps.result.outputs.last_tag }}

steps:
- name: Prepare version variables
Expand All @@ -34,17 +34,17 @@ jobs:
}
date=$(date +'%y%m%d')
echo "date=${date}" >> "$GITHUB_OUTPUT"
echo "build_date=${date}" >> "$GITHUB_OUTPUT"
tag="github${date}"
echo "build_tag=${tag}" >> "$GITHUB_OUTPUT"
dev=$(remote_revision dev)
echo "dev=${dev}" >> "$GITHUB_OUTPUT"
echo "last_rev=${dev}" >> "$GITHUB_OUTPUT"
last=$(remote_last_tag)
echo "last_tag=${last}" >> "$GITHUB_OUTPUT"
build="github${date}"
echo "build_tag=${build}" >> "$GITHUB_OUTPUT"
build:
needs: variables
runs-on: ubuntu-latest
Expand Down Expand Up @@ -162,7 +162,7 @@ jobs:
- uses: ncipollo/release-action@v1
with:
tag: ${{ needs.variables.outputs.build_tag }}
commit: ${{ needs.variables.outputs.dev }}
commit: ${{ needs.variables.outputs.last_rev }}
name: Snapshot build (${{ needs.variables.outputs.build_tag }})
bodyFile: "release_template.md"
artifacts: "Debug.zip,build/*.bin"
Expand Down

0 comments on commit 00bfa64

Please sign in to comment.