Skip to content

Commit

Permalink
update github action
Browse files Browse the repository at this point in the history
  • Loading branch information
Mosibi committed Oct 26, 2024
1 parent aac530c commit c8e6ba8
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
Binary file removed .github/scripts/.set_version.sh.swp
Binary file not shown.
2 changes: 2 additions & 0 deletions .github/scripts/set_version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ VERSION_FROM_CHANGELOG=$(grep '^## \[[0-9]' CHANGELOG.md | sed -E 's/^##\ \[([0-
VERSION_IN_YAML=$(awk '/^ {4}version:/ {print $NF}' heatpump.yaml)

if [[ ! -z "${VERSION_FROM_CHANGELOG}" ]] && [[ "${VERSION_FROM_CHANGELOG}" =~ ^[0-9].*$ ]]; then
echo "YAML_UPDATED=false" >> $GITHUB_ENV
Info "Version extracted from changelog is ${VERSION_FROM_CHANGELOG}"
Info "Current version in heatpump.yaml is ${VERSION_IN_YAML}"

Expand All @@ -47,6 +48,7 @@ if [[ ! -z "${VERSION_FROM_CHANGELOG}" ]] && [[ "${VERSION_FROM_CHANGELOG}" =~ ^
else
sed -i -E "s/(^\ {4}version:)(.*$)/\1 ${VERSION_FROM_CHANGELOG}/g" heatpump.yaml || Error "Could not update version in heatpump.yaml"
Info "Version in heatpump.yaml is successful updated to ${VERSION_FROM_CHANGELOG}"
echo "YAML_UPDATED=true" >> $GITHUB_ENV
fi
else
Warning "Version extracted from CHANGELOG.md does not seem to be a version tag: ${VERSION_FROM_CHANGELOG}, version will not be updated"
Expand Down
18 changes: 18 additions & 0 deletions .github/workflows/environment_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
name: environment-test

run-name: ${{ github.actor }} is learning GitHub Actions

on: [push]

env:
YAML_UPDATED: false

jobs:
envtester:
runs-on: ubuntu-latest
steps:
- name: One
run: echo "YAML_UPDATED is $YAML_UPDATED"
- name: Show envs
run: echo "${{ env }}"

0 comments on commit c8e6ba8

Please sign in to comment.