mirror of
https://github.com/notf0und/SGS
synced 2026-07-17 18:21:06 +00:00
102 lines
2.4 KiB
YAML
102 lines
2.4 KiB
YAML
name: Release
|
|
|
|
on:
|
|
release:
|
|
types: [published]
|
|
|
|
jobs:
|
|
test:
|
|
name: Run test suite
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up PHP
|
|
uses: shivammathur/setup-php@v2
|
|
with:
|
|
php-version: '8.4'
|
|
extensions: mbstring
|
|
coverage: none
|
|
|
|
- name: Install Composer dependencies
|
|
working-directory: www
|
|
run: composer install --no-interaction --prefer-dist --optimize-autoloader
|
|
|
|
- name: Set up environment
|
|
working-directory: www
|
|
run: |
|
|
cp .env.example .env
|
|
php artisan key:generate
|
|
|
|
- name: Build frontend assets
|
|
working-directory: www
|
|
run: npm ci && npm run build
|
|
|
|
- name: Run tests
|
|
working-directory: www
|
|
run: php artisan test
|
|
|
|
lint:
|
|
name: Check code style (Pint)
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up PHP
|
|
uses: shivammathur/setup-php@v2
|
|
with:
|
|
php-version: '8.4'
|
|
extensions: mbstring
|
|
coverage: none
|
|
|
|
- name: Install Composer dependencies
|
|
working-directory: www
|
|
run: composer install --no-interaction --prefer-dist --optimize-autoloader
|
|
|
|
- name: Run Pint
|
|
working-directory: www
|
|
run: ./vendor/bin/pint --test
|
|
|
|
docker:
|
|
name: Build and push Docker image
|
|
runs-on: ubuntu-latest
|
|
environment: prod
|
|
needs: [test, lint]
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up QEMU (multi-platform support)
|
|
uses: docker/setup-qemu-action@v3
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Log in to Docker Hub
|
|
uses: docker/login-action@v3
|
|
with:
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
|
|
- name: Extract metadata
|
|
id: meta
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
images: notf0und/sgs
|
|
tags: |
|
|
type=semver,pattern={{version}}
|
|
type=raw,value=latest
|
|
|
|
- name: Build and push
|
|
uses: docker/build-push-action@v6
|
|
with:
|
|
context: .
|
|
platforms: linux/amd64,linux/arm64
|
|
push: true
|
|
tags: ${{ steps.meta.outputs.tags }}
|