2024-11-10 11:35:00 -06:00
|
|
|
name: build
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches: ["master"]
|
|
|
|
pull_request:
|
|
|
|
branches: ["master"]
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
docker:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
packages: write
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Checkout repository
|
|
|
|
uses: actions/checkout@v4
|
|
|
|
|
|
|
|
- name: Log in to the Container registry
|
|
|
|
uses: docker/login-action@v3
|
|
|
|
with:
|
2024-11-10 11:41:06 -06:00
|
|
|
registry: scm.wyattjmiller.com
|
2024-11-10 11:35:00 -06:00
|
|
|
username: ${{ secrets.GH_ACTION_USERNAME }}
|
|
|
|
password: ${{ secrets.GH_ACTION_TOKEN }}
|
|
|
|
|
|
|
|
- name: Extract metadata (tags, labels) for Docker
|
|
|
|
id: meta
|
|
|
|
uses: docker/metadata-action@v5
|
|
|
|
with:
|
2024-11-10 12:21:34 -06:00
|
|
|
images: scm.wyattjmiller.com/wymiller/ballbot
|
2024-11-10 11:35:00 -06:00
|
|
|
tags: |
|
|
|
|
type=sha,prefix=
|
|
|
|
type=ref,event=branch
|
|
|
|
type=ref,event=pr
|
|
|
|
type=semver,pattern={{version}}
|
|
|
|
type=semver,pattern={{major}}.{{minor}}
|
|
|
|
|
|
|
|
- name: Build and test Docker image
|
|
|
|
uses: docker/build-push-action@v5
|
|
|
|
with:
|
|
|
|
context: .
|
|
|
|
target: test
|
|
|
|
push: false
|
|
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
|
|
labels: ${{ steps.meta.outputs.labels }}
|
|
|
|
|
|
|
|
- name: Build and push production Docker image
|
|
|
|
uses: docker/build-push-action@v5
|
|
|
|
with:
|
|
|
|
context: .
|
|
|
|
target: production
|
|
|
|
push: ${{ github.event_name != 'pull_request' }}
|
2024-11-10 12:21:34 -06:00
|
|
|
tags: scm.wyattjmiller.com/wymiller/ballbot
|
2024-11-10 11:35:00 -06:00
|
|
|
labels: ${{ steps.meta.outputs.labels }}
|