From 5a394ce204d786a9987771697949571ab7f41bec Mon Sep 17 00:00:00 2001 From: Michael Woods Date: Wed, 2 Dec 2020 14:13:11 -0500 Subject: [PATCH] github action and metadata files --- .dockerignore | 3 +++ .github/dependabot.yml | 7 +++++++ .github/workflows/ci.yml | 37 +++++++++++++++++++++++++++++++++++ .github/workflows/release.yml | 18 +++++++++++++++++ 4 files changed, 65 insertions(+) create mode 100644 .dockerignore create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/release.yml diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..bac77a1 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,3 @@ +.nyc_output +test +node_modules \ No newline at end of file diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..2c7d170 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,7 @@ +version: 2 +updates: + # Maintain dependencies for GitHub Actions + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "daily" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..ed7b539 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,37 @@ +name: ci + +on: + push: + branches: [ $default-branch ] + pull_request: + branches: [ $default-branch ] + +jobs: + test_build_push: + name: Test and Build & Push Docker image + + runs-on: ubuntu-latest + + strategy: + matrix: + node-version: [12.x] + + steps: + - name: Check out the repo + uses: actions/checkout@v2 + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + + - name: Push to Docker Hub + uses: docker/build-push-action@v1 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + repository: michaelwoods/onstar2mqtt + tags: michaelwoods/onstar2mqtt:latest + - run: npm ci + - run: npm run build --if-present + - run: npm test diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..0f462fe --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,18 @@ +name: Publish Docker image +on: + release: + types: [published] +jobs: + push_to_registry: + name: Push Docker image to Docker Hub + runs-on: ubuntu-latest + steps: + - name: Check out the repo + uses: actions/checkout@v2 + - name: Push to Docker Hub + uses: docker/build-push-action@v1 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + repository: michaelwoods/onstar2mqtt + tag_with_ref: true