DTEKInfo / Svitlobot - Bug fixes and cosmetic #39
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Blackout / Builder | |
on: | |
push: | |
branches: | |
- master | |
paths-ignore: | |
- '.github/**' | |
workflow_call: | |
workflow_dispatch: | |
jobs: | |
addon_changes: | |
name: π Check for Addon changes | |
runs-on: ubuntu-latest | |
outputs: | |
changed_config: ${{ steps.config.outputs.changes }} | |
changed_addons: ${{ steps.addons.outputs.changes }} | |
steps: | |
- name: β©οΈ Git Checkout | |
uses: actions/checkout@v4 | |
- name: π Make Addon list | |
run: | | |
# Init | |
echo "Starting" | |
mkdir addon-list | |
touch addon-list/paths-config.yml | |
touch addon-list/paths-addons.yml | |
# Go through all folders, add to filters if not existing | |
for f in $( find -- * -maxdepth 0 -type d | sort -r ); do | |
if [ -f "$f"/config.yaml ]; then | |
# Add to file | |
if ! grep "$f:" "addon-list/paths-config.yml"; then | |
echo "$f: $f/config.*" >> "addon-list/paths-config.yml" | |
fi | |
if ! grep "$f:" "addon-list/paths-addons.yml"; then | |
echo "$f: $f/**" >> "addon-list/paths-addons.yml" | |
fi | |
fi | |
done | |
# Sort yaml | |
sort -t= "addon-list/paths-config.yml" -o "addon-list/paths-config.yml" | |
sort -t= "addon-list/paths-addons.yml" -o "addon-list/paths-addons.yml" | |
- name: βοΈ Detect changed configs | |
uses: dorny/paths-filter@v3 | |
id: config | |
with: | |
filters: addon-list/paths-config.yml | |
- name: βοΈ Detect changed addons | |
uses: dorny/paths-filter@v3 | |
id: addons | |
with: | |
filters: addon-list/paths-addons.yml | |
test: | |
if: ${{ needs.addon_changes.outputs.changed_addons != '[]' }} | |
name: π Test ${{ matrix.addon }} add-on | |
needs: | |
- addon_changes | |
strategy: | |
matrix: | |
addon: ${{ fromJSON(needs.addon_changes.outputs.changed_addons) }} | |
uses: ./.github/workflows/docker_test.yml | |
with: | |
addon: ${{ matrix.addon }} | |
build: | |
if: ${{ needs.addon_changes.outputs.changed_config != '[]' }} | |
name: π Build ${{ matrix.addon }} add-on | |
needs: | |
- test | |
- addon_changes | |
strategy: | |
matrix: | |
addon: ${{ fromJSON(needs.addon_changes.outputs.changed_config) }} | |
uses: ./.github/workflows/docker_build.yml | |
with: | |
addon: ${{ matrix.addon }} | |
permissions: | |
contents: read | |
packages: write | |
secrets: inherit | |
release: | |
name: π¦ Blackout / Release | |
runs-on: ubuntu-latest | |
needs: | |
- build | |
permissions: | |
contents: write | |
steps: | |
- name: Get Release Version | |
run: | | |
echo "version=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT | |
id: version | |
- name: Get Release Tag | |
run: | | |
echo "tag=$(date +'%Y%m%d.%H%M')" >> $GITHUB_OUTPUT | |
id: tag | |
- name: Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
name: Blackout Addons - ${{steps.version.outputs.version}} | |
tag_name: v${{steps.tag.outputs.tag}} | |
generate_release_notes: true | |
ci-status: | |
name: π Status | |
runs-on: ubuntu-latest | |
needs: | |
- test | |
- build | |
if: always() | |
steps: | |
- name: π Success | |
if: ${{ !(contains(needs.*.result, 'failure')) }} | |
run: exit 0 | |
- name: β Failure | |
if: ${{ contains(needs.*.result, 'failure') }} | |
run: exit 1 |