Skip to content

Commit

Permalink
Improve ci workflows (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
mib1185 authored Dec 1, 2024
1 parent 836bfa7 commit 031e952
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 9 deletions.
21 changes: 12 additions & 9 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
branches: ["main"]
push:
branches: ["main"]
tags: ["*"]

jobs:
build:
Expand All @@ -16,7 +17,7 @@ jobs:

steps:
- name: Check out repository
uses: actions/checkout@v4.1.2
uses: actions/checkout@v4.2.2

- name: Get information
id: info
Expand All @@ -26,24 +27,26 @@ jobs:

- name: Set build arguments
run: |
if [[ -z "${{ github.head_ref }}" ]] && [[ "${{ github.event_name }}" == "push" ]]; then
echo "BUILD_ARGS=--docker-hub-check" >> $GITHUB_ENV;
else
echo "BUILD_ARGS=--test" >> $GITHUB_ENV;
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
echo "TEST_FLAG=--test" >> $GITHUB_ENV;
fi
if [[ "${{ github.event_name }}" == "push" ]] && [[ "${{ github.ref }}" == "refs/heads/main" ]]; then
echo "VERSION_FLAG=--version dev --no-latest" >> $GITHUB_ENV;
fi
- name: Login to DockerHub
if: env.BUILD_ARGS == '--docker-hub-check'
uses: docker/login-action@v3.1.0
if: github.event_name == 'push'
uses: docker/login-action@v3.3.0
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build snmpd add-on
uses: home-assistant/builder@2024.03.5
uses: home-assistant/builder@2024.08.2
with:
args: |
${{ env.BUILD_ARGS }} \
${{ env.TEST_FLAG }} \
${{ env.VERSION_FLAG }} \
--${{ matrix.arch }} \
--target /data/snmpd \
--addon
6 changes: 6 additions & 0 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
name: Stale

on:
schedule:
- cron: '00 10 * * *'
workflow_dispatch:

permissions:
issues: write
pull-requests: write

jobs:
stale:
runs-on: ubuntu-latest
Expand Down

0 comments on commit 031e952

Please sign in to comment.