Skip to content

Commit

Permalink
Merge pull request #3 from babblevoice/feature-githubaction-build
Browse files Browse the repository at this point in the history
add build yaml
  • Loading branch information
tinpotnick authored May 17, 2023
2 parents 646360f + 2792180 commit 55b74fd
Showing 1 changed file with 76 additions and 0 deletions.
76 changes: 76 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
name: Build

# Controls when the workflow will run
on:
workflow_dispatch:
push:
branches:
- 'main'
tags:
- 'v*.*.*'
pull_request:
branches:
- 'main'

#GH
permissions:
contents: read

jobs:
build:
runs-on: ubuntu-latest
steps:
# Get the repository's code
- name: Checkout
uses: actions/checkout@v3
# https://github.com/docker/setup-qemu-action
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
# https://github.com/docker/setup-buildx-action
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and export to Docker
uses: docker/build-push-action@v4
with:
context: .
load: true
tags: docker.io/tinpotnick/rrdb:test

#- name: Test
# Use --exit so we don't hang a test on exception
# run: |
# docker run --rm docker.io/tinpotnick/rrdb:test /bin/sh -c 'npm run github:check'

- name: Docker meta
id: ourdockertags
uses: docker/metadata-action@v3
with:
# list of Docker images to use as base name for tags
images: |
docker.io/tinpotnick/rrdb
# Docker tags based on the following events/attributes
tags: |
type=schedule
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=sha
- name: Build and push
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.ourdockertags.outputs.tags }}
labels: ${{ steps.ourdockertags.outputs.labels }}

0 comments on commit 55b74fd

Please sign in to comment.