ttrss/.gitea/workflows/build.yml

107 lines
3.1 KiB
YAML
Raw Normal View History

2023-03-25 19:41:47 +00:00
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
name: build
on:
push:
branches:
- "master"
workflow_dispatch: {}
defaults:
run:
shell: sh
jobs:
build:
runs-on: alpine-3.16
steps:
- uses: https://gitea.com/actions/checkout@v3
- name: eslint
run: npx eslint js plugins
2023-03-26 16:18:03 +00:00
- run: rm -rf node_modules
2023-03-25 19:41:47 +00:00
- name: phpunit
run: php81 ./vendor/bin/phpunit
- name: calculate cache key hash
uses: actions/go-hashfiles@v0.0.1
id: cache-hash
with:
patterns: |
classes/*.php
include/*.php
plugins/**/*.php
- name: phpstan
run: php81 -d memory_limit=-1 ./vendor/bin/phpstan --memory-limit=2G
2023-03-25 21:09:24 +00:00
- name: setup qemu
uses: https://github.com/docker/setup-qemu-action@v2
2023-03-25 19:41:47 +00:00
- name: setup buildx
uses: https://github.com/docker/setup-buildx-action@v2
2023-03-26 14:25:11 +00:00
- name: login to registry
uses: https://github.com/docker/login-action@v2
2023-03-25 19:41:47 +00:00
with:
2023-03-26 14:25:11 +00:00
registry: ${{ secrets.REGISTRY_HOST }}
username: ${{ secrets.REGISTRY_USER }}
password: ${{ secrets.REGISTRY_PASSWORD }}
2023-03-25 19:41:47 +00:00
2023-03-26 14:25:11 +00:00
- name: login to docker hub
uses: https://github.com/docker/login-action@v2
2023-03-25 19:41:47 +00:00
with:
2023-03-26 14:25:11 +00:00
username: ${{ secrets.DOCKER_HUB_USER }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}
2023-03-25 19:41:47 +00:00
2023-03-26 17:48:07 +00:00
- name: get docker meta for web-nginx
id: meta_web_nginx
uses: https://github.com/docker/metadata-action@v4
with:
images: |
${{ secrets.REGISTRY_HOST }}/cthulhoo/ttrss-web-nginx
cthulhoo/ttrss-web-nginx
tags: |
type=sha,prefix={{ date 'YY.MM-' tz='UTC'}}
type=raw,value=latest,enable={{ is_default_branch }}
2023-03-25 19:41:47 +00:00
- name: build web-nginx image
uses: https://github.com/docker/build-push-action@v4
with:
2023-03-26 14:25:11 +00:00
push: true
2023-03-25 21:09:24 +00:00
platforms: linux/amd64,linux/arm64,linux/arm/v7
2023-03-25 19:41:47 +00:00
context: .docker/web-nginx
2023-03-26 17:48:07 +00:00
tags: ${{ steps.meta_web_nginx.outputs.tags }}
labels: ${{ steps.meta_web_nginx.outputs.labels }}
2023-03-25 19:41:47 +00:00
provenance: false
2023-03-27 06:34:02 +00:00
cache-from: type=registry,ref=${{ secrets.REGISTRY_HOST }}/cthulhoo/ttrss-web-nginx:latest
cache-to: type=inline
2023-03-25 19:41:47 +00:00
2023-03-26 17:48:07 +00:00
- name: get docker meta for app
id: meta_app
uses: https://github.com/docker/metadata-action@v4
with:
images: |
${{ secrets.REGISTRY_HOST }}/cthulhoo/ttrss-fpm-pgsql-static
cthulhoo/ttrss-fpm-pgsql-static
tags: |
type=sha,prefix={{ date 'YY.MM-' tz='UTC'}}
type=raw,value=latest,enable={{ is_default_branch }}
2023-03-25 19:41:47 +00:00
- name: build app image
uses: https://github.com/docker/build-push-action@v4
with:
2023-03-26 14:25:11 +00:00
push: true
2023-03-25 21:09:24 +00:00
platforms: linux/amd64,linux/arm64,linux/arm/v7
2023-03-25 19:41:47 +00:00
context: .docker/app
build-contexts:
app-src=.
2023-03-26 17:48:07 +00:00
tags: ${{ steps.meta_app.outputs.tags }}
labels: ${{ steps.meta_app.outputs.labels }}
2023-03-25 19:41:47 +00:00
provenance: false
2023-03-27 06:34:02 +00:00
cache-from: type=registry,ref=${{ secrets.REGISTRY_HOST }}/cthulhoo/ttrss-fpm-pgsql-static:latest
cache-to: type=inline