Merge pull request #48 from itsitrio/AddMoistDogTV #136
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test and Deploy | |
on: [ push, pull_request, workflow_dispatch ] | |
jobs: | |
build: | |
name: Build and Test | |
runs-on: self-hosted | |
steps: | |
- uses: actions/checkout@master | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build Test Image | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
target: testing | |
load: true | |
tags: waterwolf-site:testing | |
cache-from: type=registry,ref=ghcr.io/waterwolfdev/waterwolf-site:buildcache,mode=max | |
- name: Run CI Test Suite | |
run: | | |
docker run --rm waterwolf-site:testing app_ci | |
publish: | |
name: Publish | |
needs: build | |
runs-on: self-hosted | |
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch' | |
steps: | |
- uses: actions/checkout@master | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build Docker Metadata | |
id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
ghcr.io/waterwolfdev/waterwolf-site | |
flavor: | | |
latest=false | |
tags: | | |
type=ref,event=branch | |
- name: Debug Docker Metadata | |
run: | | |
echo "Tags: ${{ steps.meta.outputs.tags }}" | |
echo "GitHub Ref: ${{ github.ref }}" | |
echo "Default Branch: ${{ github.event.repository.default_branch }}" | |
echo "GitHub Event Name: ${{ github.event_name }}" | |
- name: Publish to Docker Image Repo | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
push: true | |
platforms: linux/amd64 | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
cache-from: type=registry,ref=ghcr.io/waterwolfdev/waterwolf-site:buildcache,mode=max | |
cache-to: type=registry,ref=ghcr.io/waterwolfdev/waterwolf-site:buildcache,mode=max |