Skip to content

v0.5.0

v0.5.0 #92

Workflow file for this run

name: CI
on:
pull_request:
release:
types:
- published
- edited
- created
push:
branches:
- master
jobs:
tests:
name: Tests ${{ matrix.php }}
runs-on: ubuntu-latest
strategy:
matrix:
php: [ 8.2 ]
services:
# Label used to access the service container
postgres:
# Docker Hub image
image: postgres
# Provide the password for postgres
env:
POSTGRES_PASSWORD: secret
POSTGRES_DB: littledivelog
POSTGRES_USER: littledivelog
ports:
- 5432:5432
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout code
uses: actions/checkout@v1
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
- name: Install composer dependencies
run: composer install --ignore-platform-reqs --ansi
- name: Codestyle check
run: ./vendor/bin/ecs check --config=dev/ecs.php --no-interaction
- name: Prepare Env
run: |
cp .env.ci .env
php artisan key:generate
php artisan migrate:fresh --seed
- name: Run tests
run: php artisan test
Deploy:
needs: tests
if: startsWith(github.ref, 'refs/tags/v')
name: "Docker Build and Push"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
-
name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
-
name: Build and push
uses: docker/build-push-action@v2
with:
context: .
push: true
target: prod
tags: blackshadev/littledivelogserver:latest,blackshadev/littledivelogserver:${{ steps.get_version.outputs.VERSION }}
- name: Wait for docker to update
run: sleep 4s
- name: Update server image
uses: satak/[email protected]
with:
url: ${{ secrets.PORTAINER_WEB_HOOK }}
method: POST