Fix docker publish work
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
name: Build and Push Docker Image
|
||||
|
||||
on:
|
||||
workflow_run:
|
||||
workflows: ["tests"]
|
||||
types:
|
||||
- completed
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
env:
|
||||
RUNNER_TOOL_CACHE: /toolcache
|
||||
|
||||
steps:
|
||||
- name: Check out repository code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Get version
|
||||
id: get_version
|
||||
run: echo "::set-output name=version::$(cat VERSION)"
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: git.matthiasg.dev
|
||||
username: ninluc
|
||||
password: ${{ secrets.REGISTRY_TOKEN }}
|
||||
|
||||
- name: Cache Docker layers (registry-backed)
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: /tmp/.buildx-cache
|
||||
key: buildx-cache-${{ github.sha }}
|
||||
restore-keys: |
|
||||
buildx-cache-
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
context: .
|
||||
file: Dockerfile
|
||||
push: true
|
||||
tags: git.matthiasg.dev/Ninluc/perceptron-viewer/perceptron-viewer:latest, git.matthiasg.dev/Ninluc/perceptron-viewer/perceptron-viewer:${{ steps.get_version.outputs.version }}
|
||||
|
||||
# notify:
|
||||
# needs: build
|
||||
# runs-on: ubuntu-latest
|
||||
|
||||
# steps:
|
||||
# - name: Notify Watchtower
|
||||
# run: "curl -i -X POST -H \"Authorization: Bearer ${{ secrets.WATCHTOWER_TOKEN }}\" https://watchtower.beermaker.matthiasg.dev/v1/update"
|
||||
@@ -0,0 +1,78 @@
|
||||
name: linter
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- develop
|
||||
- main
|
||||
- master
|
||||
- workos
|
||||
pull_request:
|
||||
branches:
|
||||
- develop
|
||||
- main
|
||||
- master
|
||||
- workos
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
quality:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v6
|
||||
|
||||
# -------------------------
|
||||
# Cache Composer
|
||||
# -------------------------
|
||||
- name: Cache Composer dependencies
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.composer/cache
|
||||
key: composer-${{ runner.os }}-${{ hashFiles('**/composer.lock') }}
|
||||
restore-keys: |
|
||||
composer-${{ runner.os }}-
|
||||
|
||||
# -------------------------
|
||||
# Cache Node
|
||||
# -------------------------
|
||||
- name: Cache Node dependencies
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.npm
|
||||
key: node-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
|
||||
restore-keys: |
|
||||
node-${{ runner.os }}-
|
||||
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: '8.4'
|
||||
coverage: none
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '22'
|
||||
cache: 'npm'
|
||||
|
||||
# -------------------------
|
||||
# Install dependencies
|
||||
# -------------------------
|
||||
- name: Install Dependencies
|
||||
run: |
|
||||
composer install --no-interaction --prefer-dist --no-progress --no-scripts
|
||||
npm ci
|
||||
|
||||
# -------------------------
|
||||
# Run linters in parallel
|
||||
# -------------------------
|
||||
- name: Run linters
|
||||
run: |
|
||||
composer lint &
|
||||
npm run format &
|
||||
npm run lint &
|
||||
wait
|
||||
@@ -0,0 +1,90 @@
|
||||
name: tests
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- develop
|
||||
- main
|
||||
- master
|
||||
- workos
|
||||
pull_request:
|
||||
branches:
|
||||
- develop
|
||||
- main
|
||||
- master
|
||||
- workos
|
||||
|
||||
jobs:
|
||||
ci:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
php-version: ['8.4', '8.5']
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v6
|
||||
|
||||
# -------------------------
|
||||
# Cache Composer
|
||||
# -------------------------
|
||||
- name: Cache Composer dependencies
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.composer/cache
|
||||
key: composer-${{ runner.os }}-${{ matrix.php-version }}-${{ hashFiles('**/composer.lock') }}
|
||||
restore-keys: |
|
||||
composer-${{ runner.os }}-${{ matrix.php-version }}-
|
||||
|
||||
# -------------------------
|
||||
# Cache Node
|
||||
# -------------------------
|
||||
- name: Cache Node dependencies
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ~/.npm
|
||||
key: node-${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
|
||||
restore-keys: |
|
||||
node-${{ runner.os }}-
|
||||
|
||||
- name: Setup PHP
|
||||
uses: shivammathur/setup-php@v2
|
||||
with:
|
||||
php-version: ${{ matrix.php-version }}
|
||||
tools: composer:v2
|
||||
coverage: none
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: '22'
|
||||
cache: 'npm'
|
||||
|
||||
# -------------------------
|
||||
# Install dependencies
|
||||
# -------------------------
|
||||
- name: Install Node Dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Install PHP Dependencies
|
||||
run: composer install --no-interaction --prefer-dist --optimize-autoloader --no-progress
|
||||
|
||||
# -------------------------
|
||||
# Laravel setup
|
||||
# -------------------------
|
||||
- name: Prepare environment
|
||||
run: |
|
||||
cp .env.example .env
|
||||
php artisan key:generate
|
||||
|
||||
# -------------------------
|
||||
# Build (optional – remove if not needed for tests)
|
||||
# -------------------------
|
||||
- name: Build Assets
|
||||
run: npm run build
|
||||
|
||||
# -------------------------
|
||||
# Run tests (parallel)
|
||||
# -------------------------
|
||||
- name: Run Tests
|
||||
run: php artisan test --parallel
|
||||
Reference in New Issue
Block a user