@babblevoice/projectrtp
Version:
A scalable Node addon RTP server
77 lines (69 loc) • 2.16 kB
YAML
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/projectrtp:test
- name: Test
# Use --exit so we don't hang a test on exception
run: |
docker run --rm docker.io/tinpotnick/projectrtp: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/projectrtp
# 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 }}