Skip to content

Commit db58db4

Browse files
authored
[ci] add release process and info.md file for HACS (#58)
* Add info.md file for a better experience with HACS * Add release process and auto-updates of info.md
1 parent 44d2911 commit db58db4

File tree

5 files changed

+454
-4
lines changed

5 files changed

+454
-4
lines changed

.github/workflows/build.yaml

Lines changed: 72 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,10 @@ jobs:
1717
name: Prepare environment
1818
runs-on: "ubuntu-latest"
1919
outputs:
20-
requires_tests: ${{ github.event_name == 'schedule' || steps.changed-files.outputs.any_changed == 'true' || steps.changed-files.outputs.any_deleted == 'true' || steps.changed-files.outputs.any_modified == 'true' }}
20+
requires_tests: ${{ github.event_name == 'schedule' || steps.changed-files.outputs.any_changed == 'true' || steps.changed-files.outputs.any_deleted == 'true' || steps.changed-files.outputs.any_modified == 'true' || env.PUBLISH_RELEASE == 'true' }}
21+
publish_release: ${{ env.PUBLISH_RELEASE }}
22+
release_version: ${{ env.RELEASE_VERSION }}
23+
release_desc: ${{ env.RELEASE_DESC }}
2124
steps:
2225
- name: Checkout current commit
2326
uses: "actions/checkout@v3"
@@ -33,6 +36,14 @@ jobs:
3336
tests/**
3437
.github/workflows/build.yaml
3538
39+
- name: Check if a new release should be published
40+
if: github.event_name == 'push'
41+
env:
42+
GITHUB_EVENT: ${{ toJSON(github.event) }}
43+
run: |
44+
.github/workflows/scripts/release.py --printenv | tee -a "$GITHUB_ENV"
45+
46+
3647
unit-integration-tests:
3748
name: Unit & integration tests
3849
runs-on: "ubuntu-latest"
@@ -202,13 +213,73 @@ jobs:
202213
pytest --cache-clear tests/end-to-end/
203214
204215
216+
update_changelog:
217+
name: Update changelog
218+
runs-on: "ubuntu-latest"
219+
220+
needs:
221+
- prepare-env
222+
- unit-integration-tests
223+
- end-to-end-tests
224+
225+
if: github.event_name == 'push' && needs.prepare-env.outputs.publish_release != 'true' && needs.unit-integration-tests.result != 'failure' && needs.end-to-end-tests.result != 'failure'
226+
227+
steps:
228+
- name: Checkout current commit
229+
uses: "actions/checkout@v3"
230+
231+
- name: Update changelog for future release
232+
env:
233+
GITHUB_EVENT: ${{ toJSON(github.event) }}
234+
run: |
235+
.github/workflows/scripts/release.py --update-changelog
236+
237+
- name: Commit changes
238+
uses: stefanzweifel/git-auto-commit-action@v4
239+
with:
240+
file_pattern: "info.md"
241+
commit_message: 📒 Update changelog for future release
242+
243+
244+
push_release:
245+
name: Release version
246+
runs-on: ubuntu-latest
247+
248+
needs:
249+
- prepare-env
250+
- unit-integration-tests
251+
- end-to-end-tests
252+
253+
if: github.event_name == 'push' && needs.prepare-env.outputs.publish_release == 'true' && needs.unit-integration-tests.result != 'failure' && needs.end-to-end-tests.result != 'failure'
254+
255+
permissions:
256+
contents: write
257+
258+
steps:
259+
- name: Checkout current commit
260+
uses: "actions/checkout@v3"
261+
262+
- name: Release version
263+
uses: ncipollo/release-action@v1
264+
with:
265+
tag: v${{ needs.prepare-env.outputs.release_version }}
266+
name: v${{ needs.prepare-env.outputs.release_version }}
267+
body: ${{ needs.prepare-env.outputs.release_desc }}
268+
commit: main
269+
makeLatest: true
270+
skipIfReleaseExists: true
271+
272+
205273
auto-merge:
206274
name: "Auto-merge Dependabot pull requests"
207275
runs-on: ubuntu-latest
276+
208277
needs:
209278
- unit-integration-tests
210279
- end-to-end-tests
280+
211281
if: github.event_name == 'pull_request' && github.actor == 'dependabot[bot]' && needs.unit-integration-tests.result != 'failure' && needs.end-to-end-tests.result != 'failure'
282+
212283
steps:
213284
- name: Checkout current commit
214285
uses: "actions/checkout@v3"

0 commit comments

Comments
 (0)