Combined workflow files

This commit is contained in:
Chris Kankiewicz
2025-03-19 10:41:37 -07:00
parent 9f36b6ad94
commit 69392102fb
2 changed files with 42 additions and 46 deletions

View File

@@ -1,4 +1,4 @@
name: Directory Lister Test Suite
name: Directory Lister CI
on: [push, pull_request, workflow_dispatch]
jobs:
@@ -28,7 +28,7 @@ jobs:
coding-standards:
name: Coding Standards
runs-on: 'ubuntu-latest'
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
@@ -48,7 +48,7 @@ jobs:
static-analysis:
name: Static Analysis
runs-on: 'ubuntu-latest'
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
@@ -68,7 +68,7 @@ jobs:
tests:
name: Tests
runs-on: 'ubuntu-latest'
runs-on: ubuntu-latest
services:
redis:
@@ -109,11 +109,48 @@ jobs:
- name: Run Tests
run: app/vendor/bin/phpunit --coverage-text
build-and-push-image:
name: Build & Push Image
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')
needs: [asset-compilation, coding-standards, static-analysis, tests]
env:
DOCKER_HUB_USER: phlak
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ env.DOCKER_HUB_USER }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Extract Metadata
id: extract-metadata
uses: docker/metadata-action@v5
with:
images: ${{ env.DOCKER_HUB_USER }}/directory-lister
tags: |
type=raw,value=latest
type=ref,event=tag
- name: Build & Push Image
uses: docker/build-push-action@v6
with:
file: Dockerfile.prod
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.extract-metadata.outputs.tags }}
labels: ${{ steps.extract-metadata.outputs.labels }}
release:
name: Create Release
runs-on: 'ubuntu-latest'
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
needs: [asset-compilation, coding-standards, static-analysis, tests]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

View File

@@ -1,41 +0,0 @@
name: Publish Image
on:
push:
branches: ['master']
tags: ['*']
env:
DOCKER_HUB_USER: phlak
jobs:
build-and-push:
name: Build & Push
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Log in to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ env.DOCKER_HUB_USER }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
- name: Extract Metadata
id: extract-metadata
uses: docker/metadata-action@v5
with:
images: ${{ env.DOCKER_HUB_USER }}/directory-lister
tags: |
type=raw,value=latest
type=ref,event=tag
- name: Build & Push Image
uses: docker/build-push-action@v6
with:
file: Dockerfile.prod
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.extract-metadata.outputs.tags }}
labels: ${{ steps.extract-metadata.outputs.labels }}