# 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 - run: rm -rf node_modules - 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 - uses: https://github.com/actions/cache/restore@v3 id: cache-phpstan with: path: /tmp/phpstan key: ${{ runner.os }}-phpstan-${{ steps.cache-hash.outputs.hash }} - name: phpstan run: php81 -d memory_limit=-1 ./vendor/bin/phpstan --memory-limit=2G - uses: https://github.com/actions/cache/save@v3 with: path: /tmp/phpstan key: ${{ steps.cache-phpstan.outputs.cache-primary-key }} - run: echo REPO_TIMESTAMP=$(git --git-dir '.git' --no-pager log --pretty='%ct' -n1 HEAD) >> $GITHUB_ENV - run: echo REPO_COMMIT=$(git --git-dir '.git' --no-pager log --pretty='%h' -n1 HEAD) >> $GITHUB_ENV - run: echo REPO_COMMIT_FULL=$(git --git-dir '.git' --no-pager log --pretty='%H' -n1 HEAD) >> $GITHUB_ENV - run: echo BUILD_TAG=$(date -d @${REPO_TIMESTAMP} +%y.%m)-${REPO_COMMIT} >> $GITHUB_ENV - name: setup qemu uses: https://github.com/docker/setup-qemu-action@v2 - name: setup buildx uses: https://github.com/docker/setup-buildx-action@v2 - name: login to registry uses: https://github.com/docker/login-action@v2 with: registry: ${{ secrets.REGISTRY_HOST }} username: ${{ secrets.REGISTRY_USER }} password: ${{ secrets.REGISTRY_PASSWORD }} - name: login to docker hub uses: https://github.com/docker/login-action@v2 with: username: ${{ secrets.DOCKER_HUB_USER }} password: ${{ secrets.DOCKER_HUB_TOKEN }} - name: build web-nginx image uses: https://github.com/docker/build-push-action@v4 with: push: true platforms: linux/amd64,linux/arm64,linux/arm/v7 context: .docker/web-nginx tags: | ${{ secrets.REGISTRY_HOST }}/cthulhoo/ttrss-web-nginx:latest ${{ secrets.REGISTRY_HOST }}/cthulhoo/ttrss-web-nginx:${{ env.BUILD_TAG }} cthulhoo/ttrss-web-nginx:latest cthulhoo/ttrss-web-nginx:${{ env.BUILD_TAG }} provenance: false - name: build app image uses: https://github.com/docker/build-push-action@v4 with: push: true platforms: linux/amd64,linux/arm64,linux/arm/v7 context: .docker/app build-contexts: app-src=. tags: | ${{ secrets.REGISTRY_HOST }}/cthulhoo/ttrss-fpm-pgsql-static:latest ${{ secrets.REGISTRY_HOST }}/cthulhoo/ttrss-fpm-pgsql-static:${{ env.BUILD_TAG }} cthulhoo/ttrss-fpm-pgsql-static:latest cthulhoo/ttrss-fpm-pgsql-static:${{ env.BUILD_TAG }} provenance: false