From 0bb1edbd5ac6b37d7a739df5a9639018f289ba35 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sat, 25 Mar 2023 20:23:50 +0300 Subject: use unified job setup --- .gitea/workflows/build-dockerhub.yml | 81 ------------------------------------ .gitea/workflows/build.yml | 45 +++++++++++++++++++- .gitea/workflows/lint.yaml | 3 ++ 3 files changed, 47 insertions(+), 82 deletions(-) delete mode 100644 .gitea/workflows/build-dockerhub.yml (limited to '.gitea') diff --git a/.gitea/workflows/build-dockerhub.yml b/.gitea/workflows/build-dockerhub.yml deleted file mode 100644 index 053ae16..0000000 --- a/.gitea/workflows/build-dockerhub.yml +++ /dev/null @@ -1,81 +0,0 @@ -# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json - -name: build-dockerhub - -on: - push: - branches: - - "master" - workflow_dispatch: {} - -defaults: - run: - shell: sh - -jobs: - lint: - runs-on: alpine-3.16 - steps: - - uses: https://gitea.com/actions/checkout@v3 - - - name: eslint - run: npx eslint js - - - name: phpstan - run: php81 -d memory_limit=-1 ./vendor/bin/phpstan --memory-limit=2G - - build-dockerhub: - runs-on: alpine-3.16 - if: ${{ !!secrets.REGISTRY_GITHUB_PUSH_ENABLED }} - steps: - - - 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 buildx - uses: https://github.com/docker/setup-buildx-action@v2 - - - name: login into registry - run: | - BASE64_AUTH=`echo -n "$REGISTRY_USER:$REGISTRY_PASSWORD" | base64` - mkdir -p ~/.docker - echo "{\"auths\": {\"$REGISTRY_HOST\": {\"auth\": \"$BASE64_AUTH\"}}}" > ~/.docker/config.json - env: - REGISTRY_USER: ${{ secrets.REGISTRY_GITHUB_USER }} - REGISTRY_PASSWORD: ${{ secrets.REGISTRY_GITHUB_ACCESS_TOKEN }} - REGISTRY_HOST: https://index.docker.io/v1/ - if: ${{ !!secrets.REGISTRY_GITHUB_PUSH_ENABLED }} - - - name: build web-nginx image - uses: https://github.com/docker/build-push-action@v4 - with: - push: ${{ !!secrets.REGISTRY_GITHUB_PUSH_ENABLED }} - context: .docker/web-nginx - tags: | - cthulhoo/the-epube-web-nginx:latest - cthulhoo/the-epube-web-nginx:${{ env.BUILD_TAG }} - provenance: false - - - name: build dict image - uses: https://github.com/docker/build-push-action@v4 - with: - push: ${{ !!secrets.REGISTRY_GITHUB_PUSH_ENABLED }} - context: .docker/dict - tags: | - cthulhoo/the-epube-dict:latest - cthulhoo/the-epube-dict:${{ env.BUILD_TAG }} - provenance: false - - - name: build app image - uses: https://github.com/docker/build-push-action@v4 - with: - push: ${{ !!secrets.REGISTRY_GITHUB_PUSH_ENABLED }} - context: .docker/app - build-contexts: - app-src=. - tags: | - cthulhoo/the-epube-fpm-static:latest - cthulhoo/the-epube-fpm-static:${{ env.BUILD_TAG }} - provenance: false diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml index 00e723a..52098d7 100644 --- a/.gitea/workflows/build.yml +++ b/.gitea/workflows/build.yml @@ -13,7 +13,7 @@ defaults: shell: sh jobs: - build: + build-internal: runs-on: alpine-3.16 steps: - uses: https://gitea.com/actions/checkout@v3 @@ -73,3 +73,46 @@ jobs: registry-rw.fakecake.org/cthulhoo/the-epube-fpm-static:latest registry-rw.fakecake.org/cthulhoo/the-epube-fpm-static:${{ env.BUILD_TAG }} provenance: false + + - name: login into docker hub + run: | + BASE64_AUTH=`echo -n "$REGISTRY_USER:$REGISTRY_PASSWORD" | base64` + mkdir -p ~/.docker + echo "{\"auths\": {\"$REGISTRY_HOST\": {\"auth\": \"$BASE64_AUTH\"}}}" > ~/.docker/config.json + env: + REGISTRY_USER: ${{ secrets.REGISTRY_GITHUB_USER }} + REGISTRY_PASSWORD: ${{ secrets.REGISTRY_GITHUB_ACCESS_TOKEN }} + REGISTRY_HOST: https://index.docker.io/v1/ + if: ${{ !!secrets.REGISTRY_GITHUB_PUSH_ENABLED }} + + - name: build web-nginx image + uses: https://github.com/docker/build-push-action@v4 + with: + push: ${{ !!secrets.REGISTRY_GITHUB_PUSH_ENABLED }} + context: .docker/web-nginx + tags: | + cthulhoo/the-epube-web-nginx:latest + cthulhoo/the-epube-web-nginx:${{ env.BUILD_TAG }} + provenance: false + + - name: build dict image + uses: https://github.com/docker/build-push-action@v4 + with: + push: ${{ !!secrets.REGISTRY_GITHUB_PUSH_ENABLED }} + context: .docker/dict + tags: | + cthulhoo/the-epube-dict:latest + cthulhoo/the-epube-dict:${{ env.BUILD_TAG }} + provenance: false + + - name: build app image + uses: https://github.com/docker/build-push-action@v4 + with: + push: ${{ !!secrets.REGISTRY_GITHUB_PUSH_ENABLED }} + context: .docker/app + build-contexts: + app-src=. + tags: | + cthulhoo/the-epube-fpm-static:latest + cthulhoo/the-epube-fpm-static:${{ env.BUILD_TAG }} + provenance: false diff --git a/.gitea/workflows/lint.yaml b/.gitea/workflows/lint.yaml index 5df3de2..0a8e7df 100644 --- a/.gitea/workflows/lint.yaml +++ b/.gitea/workflows/lint.yaml @@ -3,6 +3,9 @@ name: lint on: + push: + branches: + - "!master" pull_request: {} defaults: -- cgit v1.2.3