add extra labels and configs to docker workflows

This commit is contained in:
Michael Woods 2020-12-02 15:52:43 -05:00
parent e029012094
commit 458fd5292a
3 changed files with 44 additions and 11 deletions

View File

@ -5,3 +5,7 @@ updates:
directory: "/" directory: "/"
schedule: schedule:
interval: "daily" interval: "daily"
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "daily"

View File

@ -5,11 +5,13 @@ on:
branches: [ main ] branches: [ main ]
pull_request: pull_request:
branches: [ main ] branches: [ main ]
# build weekly for fresh base docker image
schedule:
- cron: '30 4 * * 1'
jobs: jobs:
test_build_push: test_build_push:
name: Test and Build & Push Docker image name: ci - test, build, push
runs-on: ubuntu-latest runs-on: ubuntu-latest
strategy: strategy:
@ -20,11 +22,17 @@ jobs:
- name: Check out the repo - name: Check out the repo
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Docker meta
id: docker_meta
uses: crazy-max/ghaction-docker-meta@v1
with:
images: michaelwoods/onstar2mqtt
tag-sha: true
- name: Use Node.js ${{ matrix.node-version }} - name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1 uses: actions/setup-node@v1
with: with:
node-version: ${{ matrix.node-version }} node-version: ${{ matrix.node-version }}
- run: npm ci - run: npm ci
- run: npm run build --if-present - run: npm run build --if-present
- run: npm test - run: npm test
@ -34,6 +42,7 @@ jobs:
- name: Set up Docker Buildx - name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1 uses: docker/setup-buildx-action@v1
- name: Login to DockerHub - name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@v1 uses: docker/login-action@v1
with: with:
username: ${{ secrets.DOCKER_USERNAME }} username: ${{ secrets.DOCKER_USERNAME }}
@ -41,5 +50,7 @@ jobs:
- name: Push to Docker Hub - name: Push to Docker Hub
uses: docker/build-push-action@v2 uses: docker/build-push-action@v2
with: with:
push: true platforms: linux/amd64,linux/arm64
tags: michaelwoods/onstar2mqtt:latest push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}

View File

@ -1,18 +1,36 @@
name: release name: release
on: on:
release: release:
types: [published] types: [published]
jobs: jobs:
push_to_registry: push_to_registry:
name: Push Docker image to Docker Hub name: release - build, push
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Check out the repo - name: Check out the repo
uses: actions/checkout@v2 uses: actions/checkout@v2
- name: Push to Docker Hub
uses: docker/build-push-action@v1 - name: Docker meta
id: docker_meta
uses: crazy-max/ghaction-docker-meta@v1
with:
images: michaelwoods/onstar2mqtt
tag-sha: true
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Login to DockerHub
uses: docker/login-action@v1
with: with:
username: ${{ secrets.DOCKER_USERNAME }} username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }} password: ${{ secrets.DOCKER_PASSWORD }}
repository: michaelwoods/onstar2mqtt - name: Push to Docker Hub
tag_with_ref: true uses: docker/build-push-action@v2
with:
platforms: linux/amd64,linux/arm64
push: true
tags: ${{ steps.docker_meta.outputs.tags }}
labels: ${{ steps.docker_meta.outputs.labels }}