diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..feca1b1 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,15 @@ +name: Docker build and shellcheck + +on: [push, pull_request] + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v1 + - name: shellcheck + run: shellcheck telegraf/run.sh + - name: build docker files + run: docker run --rm --privileged -v /var/run/docker.sock:/var/run/docker.sock -v ~/.docker:/root/.docker -v "$(pwd)":/data homeassistant/amd64-builder -t telegraf --all --test diff --git a/.github/workflows/tag.yml b/.github/workflows/tag.yml new file mode 100644 index 0000000..4b0a533 --- /dev/null +++ b/.github/workflows/tag.yml @@ -0,0 +1,57 @@ +name: if release + +on: + push: + branches: [master] + tags: + - 0.* + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v1 + - name: shellcheck + run: shellcheck telegraf/run.sh + - name: build docker files + run: docker run --rm --privileged -v /var/run/docker.sock:/var/run/docker.sock -v ~/.docker:/root/.docker -v "$(pwd)":/data homeassistant/amd64-builder -t telegraf --all --test + - name: deploy docker files + if: github.event_name != 'pull_request' + run: docker run --rm --privileged -v /var/run/docker.sock:/var/run/docker.sock -v /home/travis/.docker:/root/.docker -v "$(pwd)":/data homeassistant/amd64-builder --target telegraf --all --release-tag --docker-user sabuto --docker-password ${{ secrets.DOCKER_PASSWORD }} + + push-config-to-main-repo: + needs: build + + runs-on: ubuntu-latest + + steps: + - name: main + uses: actions/checkout@v2 + with: + persist-credentials: false + fetch-depth: 0 + path: main + - name: secondary + uses: actions/checkout@v2 + with: + persist-credentials: false + fetch-depth: 0 + path: secondary + repository: sabuto/hassio-repo-dev + + - name: setup local env + run: | + \cp -Rv main/telegraf/config.json secondary/telegraf/config.json + cd secondary + git config --local user.email "robe_dunne@hotmail.com" + git config --local user.name "sabuto" + git add . + git commit -m "Add changes" + + - name: copy config to repo dir in case of change + uses: ad-m/github-push-action@master + with: + github_token: ${{ secrets.GITHUB_PSA }} + repository: sabuto/hassio-repo-dev + directory: secondary diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 1f27360..0000000 --- a/.travis.yml +++ /dev/null @@ -1,18 +0,0 @@ -sudo: required - -services: - - docker - -before_install: - - chmod +x build.sh - - chmod +x dist.sh - -jobs: - include: - - stage: Build Docker Images - script: - - $TRAVIS_BUILD_DIR/build.sh - - stage: Deploys Docker Images to Docker Hub - if: type != pull_request AND tag IS present - script: - - $TRAVIS_BUILD_DIR/dist.sh diff --git a/build.sh b/build.sh deleted file mode 100644 index 2674a60..0000000 --- a/build.sh +++ /dev/null @@ -1,12 +0,0 @@ -set -ev - -docker pull homeassistant/amd64-builder - -docker run --rm --privileged \ - -v /var/run/docker.sock:/var/run/docker.sock \ - -v ~/.docker:/root/.docker \ - -v "$(pwd)":/data \ - homeassistant/amd64-builder \ - -t telegraf \ - --all \ - --test diff --git a/dist.sh b/dist.sh deleted file mode 100644 index b4d252c..0000000 --- a/dist.sh +++ /dev/null @@ -1,19 +0,0 @@ -set -ev - -if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then - echo "This build is a pull request, abort!" - exit 0 -fi - -docker login -u "${DOCKER_USERNAME}" -p "${DOCKER_PASSWORD}" - -docker pull homeassistant/amd64-builder - -docker run --rm --privileged \ - -v /var/run/docker.sock:/var/run/docker.sock \ - -v /home/travis/.docker:/root/.docker \ - -v "$(pwd)":/data \ - homeassistant/amd64-builder \ - --target telegraf \ - --all \ - --release-tag