summaryrefslogtreecommitdiff
path: root/.gitea/workflows/build.yml
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2023-03-25 18:20:30 +0300
committerAndrew Dolgov <[email protected]>2023-03-25 19:41:33 +0300
commit339f41f0f275a3ee6d5bc0b6e146d051cabdbd8a (patch)
treea27811b19352fbb8a4b24f33f909279312f26bce /.gitea/workflows/build.yml
parent66edaa02d8cbff4a08807e6770df0e12dd530566 (diff)
add build workflow
Diffstat (limited to '.gitea/workflows/build.yml')
-rw-r--r--.gitea/workflows/build.yml75
1 files changed, 75 insertions, 0 deletions
diff --git a/.gitea/workflows/build.yml b/.gitea/workflows/build.yml
new file mode 100644
index 0000000..00e723a
--- /dev/null
+++ b/.gitea/workflows/build.yml
@@ -0,0 +1,75 @@
+# 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
+
+ - name: phpstan
+ run: php81 -d memory_limit=-1 ./vendor/bin/phpstan --memory-limit=2G
+
+ - 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-rw.fakecake.org\": {\"auth\": \"$BASE64_AUTH\"}}}" > ~/.docker/config.json
+ env:
+ REGISTRY_USER: ${{ secrets.REGISTRY_USER }}
+ REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }}
+ if: ${{ !!secrets.REGISTRY_PUSH_ENABLED }}
+
+ - name: build web-nginx image
+ uses: https://github.com/docker/build-push-action@v4
+ with:
+ push: ${{ !!secrets.REGISTRY_PUSH_ENABLED }}
+ context: .docker/web-nginx
+ tags: |
+ registry-rw.fakecake.org/cthulhoo/the-epube-web-nginx:latest
+ registry-rw.fakecake.org/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_PUSH_ENABLED }}
+ context: .docker/dict
+ tags: |
+ registry-rw.fakecake.org/cthulhoo/the-epube-dict:latest
+ registry-rw.fakecake.org/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_PUSH_ENABLED }}
+ context: .docker/app
+ build-contexts:
+ app-src=.
+ tags: |
+ registry-rw.fakecake.org/cthulhoo/the-epube-fpm-static:latest
+ registry-rw.fakecake.org/cthulhoo/the-epube-fpm-static:${{ env.BUILD_TAG }}
+ provenance: false