From c2e28eaee1c1f624129cdedbce342b6e0f553546 Mon Sep 17 00:00:00 2001 From: Koen Kanters Date: Mon, 10 Aug 2020 20:43:50 +0200 Subject: [PATCH 1/2] Switch to Github actions stale --- .github/stale.yml | 13 ------------- .github/workflows/stale.yml | 16 ++++++++++++++++ 2 files changed, 16 insertions(+), 13 deletions(-) delete mode 100644 .github/stale.yml create mode 100644 .github/workflows/stale.yml diff --git a/.github/stale.yml b/.github/stale.yml deleted file mode 100644 index f21110528..000000000 --- a/.github/stale.yml +++ /dev/null @@ -1,13 +0,0 @@ -# Number of days of inactivity before an issue becomes stale -daysUntilStale: 30 -# Number of days of inactivity before a stale issue is closed -daysUntilClose: 7 -# Label to use when marking an issue as stale -staleLabel: stale -# Comment to post when marking an issue as stale. Set to `false` to disable -markComment: > - This issue has been automatically marked as stale because it has not had - recent activity. It will be closed if no further activity occurs. Thank you - for your contributions. -# Comment to post when closing a stale issue. Set to `false` to disable -closeComment: false \ No newline at end of file diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml new file mode 100644 index 000000000..2818228c4 --- /dev/null +++ b/.github/workflows/stale.yml @@ -0,0 +1,16 @@ +name: "Close stale issues/pull requests" +on: + schedule: + - cron: "0 0 * * *" + +jobs: + stale: + runs-on: ubuntu-latest + steps: + - uses: actions/stale@v3 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + stale-issue-message: 'This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days' + stale-pr-message: 'This pull request is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days' + days-before-stale: 30 + days-before-close: 7 From a519577cf74f461fbc777e12465d93862771bcf8 Mon Sep 17 00:00:00 2001 From: Koen Kanters Date: Mon, 10 Aug 2020 21:06:22 +0200 Subject: [PATCH 2/2] Migrate from Azure to Github actions. --- .github/workflows/ci.yml | 48 +++++++++++++++++++++- azure-pipelines.yaml | 88 ---------------------------------------- 2 files changed, 47 insertions(+), 89 deletions(-) delete mode 100644 azure-pipelines.yaml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d035e958d..39a560095 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,4 +26,50 @@ jobs: - name: Test run: npm run test-with-coverage - name: Lint - run: npm run eslint \ No newline at end of file + run: npm run eslint + - name: Docker login + if: (github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/master') && github.event_name == 'push' + run: echo ${{ secrets.DOCKER_KEY }} | docker login -u koenkk --password-stdin + - name: Docker setup + if: (github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/master') && github.event_name == 'push' + run: | + sudo wget -O /usr/local/bin/buildx https://github.com/docker/buildx/releases/download/v0.3.1/buildx-v0.3.1.linux-amd64 + sudo chmod a+x /usr/local/bin/buildx + docker run --rm --privileged hypriot/qemu-register:v2.7.0 + buildx create --use + buildx ls + - name: Docker build dev + if: github.ref == 'refs/heads/dev' && github.event_name == 'push' + run: | + buildx build \ + --build-arg COMMIT=$(git rev-parse --short HEAD) \ + --platform linux/arm64/v8,linux/amd64,linux/arm/v6,linux/arm/v7,linux/386 \ + -f docker/Dockerfile \ + --push \ + -t koenkk/zigbee2mqtt:latest-dev \ + . + - name: Docker build release + if: startsWith(github.ref, 'refs/tags/') && github.event_name == 'push' + run: | + TAG="$(git describe --tags)" + buildx build \ + --build-arg COMMIT=$(git rev-parse --short HEAD) \ + --platform linux/arm64/v8,linux/amd64,linux/arm/v6,linux/arm/v7,linux/386 \ + -f docker/Dockerfile \ + --push \ + -t koenkk/zigbee2mqtt:latest -t "koenkk/zigbee2mqtt:$TAG" \ + . + - name: Publish to npm + if: startsWith(github.ref, 'refs/tags/') && github.event_name == 'push' + run: npm publish + env: + NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN }} + - name: Trigger danielwelch/hassio-zigbee2mqtt build + if: github.ref == 'refs/heads/dev' && github.event_name == 'push' + run: | + curl -s \ + --request POST \ + --header "Content-Type: application/json" \ + --data '{"definition": {"id": 1}}' \ + -u ${{ secrets.HASSIO_TRIGGER_SECRET }} \ + "https://dev.azure.com/danielwelch2101/hassio-zigbee2mqtt/_apis/build/builds?api-version=5.1" \ No newline at end of file diff --git a/azure-pipelines.yaml b/azure-pipelines.yaml deleted file mode 100644 index 7bf8897d3..000000000 --- a/azure-pipelines.yaml +++ /dev/null @@ -1,88 +0,0 @@ -trigger: - tags: - include: - - '*' - branches: - include: - - '*' - -pool: - vmImage: 'ubuntu-latest' - -steps: - -# Prepare -- task: NodeTool@0 - inputs: - versionSpec: '12.x' - displayName: 'Install Node.js' -- bash: npm ci - displayName: 'Install dependencies' - -# Verify -- bash: npm run test-with-coverage - displayName: 'Test' -- bash: npm run eslint - displayName: 'Lint' - -# NPM -- task: Npm@1 - inputs: - command: publish - publishEndpoint: npm - displayName: 'Publish to npm' - condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/'), ne(variables['Build.Reason'], 'PullRequest')) - -# Docker -- task: DockerInstaller@0 - displayName: Docker install - condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest')) - inputs: - dockerVersion: 19.03.5 - releaseType: stable -- task: Docker@2 - displayName: Docker registry login - condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest')) - inputs: - command: login - containerRegistry: docker_registry -- bash: | - sudo wget -O /usr/local/bin/buildx https://github.com/docker/buildx/releases/download/v0.3.1/buildx-v0.3.1.linux-amd64 - sudo chmod a+x /usr/local/bin/buildx - docker run --rm --privileged hypriot/qemu-register:v2.7.0 - buildx create --use - buildx ls - displayName: 'Docker setup' - condition: and(succeeded(), ne(variables['Build.Reason'], 'PullRequest')) -- bash: | - buildx build \ - --build-arg COMMIT=$(git rev-parse --short HEAD) \ - --platform linux/arm64/v8,linux/amd64,linux/arm/v6,linux/arm/v7,linux/386 \ - -f docker/Dockerfile \ - --push \ - -t koenkk/zigbee2mqtt:latest-dev \ - . - displayName: 'Docker build dev' - condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/dev'), ne(variables['Build.Reason'], 'PullRequest')) -- bash: | - TAG="$(git describe --tags)" - buildx build \ - --build-arg COMMIT=$(git rev-parse --short HEAD) \ - --platform linux/arm64/v8,linux/amd64,linux/arm/v6,linux/arm/v7,linux/386 \ - -f docker/Dockerfile \ - --push \ - -t koenkk/zigbee2mqtt:latest -t "koenkk/zigbee2mqtt:$TAG" \ - . - displayName: 'Docker build release' - condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/'), ne(variables['Build.Reason'], 'PullRequest')) - -# Trigger Home Assistant Zigbee2mqtt addon build -- bash: | - curl -s \ - --request POST \ - --header "Content-Type: application/json" \ - --data '{"definition": {"id": 1}}' \ - -u "$(HASSIO_TRIGGER_SECRET)" \ - "https://dev.azure.com/danielwelch2101/hassio-zigbee2mqtt/_apis/build/builds?api-version=5.1" - displayName: 'Trigger Hass.io build' - condition: and(succeeded(), eq(variables['Build.SourceBranch'], 'refs/heads/dev'), ne(variables['Build.Reason'], 'PullRequest'))