diff --git a/.github/workflows/deploy-image.yml b/.github/workflows/build-image.yml similarity index 93% rename from .github/workflows/deploy-image.yml rename to .github/workflows/build-image.yml index 27051a1..484bcb8 100644 --- a/.github/workflows/deploy-image.yml +++ b/.github/workflows/build-image.yml @@ -2,6 +2,7 @@ name: Build Docker image on: workflow_dispatch: + pull_request: push: tags: - "v**" @@ -37,7 +38,7 @@ jobs: with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} tags: | # almost same as action default - type=ref,event=branch + type=ref,event=pr type=ref,event=tag,pattern={{raw}} # type=ref,event=workflow_dispatch type=sha,event=workflow_dispatch @@ -49,7 +50,7 @@ jobs: uses: docker/build-push-action@v6.9.0 with: context: . - push: true + push: ${{ github.event_name != 'pull_request' }} build-args: MOEFLOW_BUILD_ID=${{ github.repository }}:${{ github.ref }}:${{ github.sha }} cache-from: diff --git a/Dockerfile b/Dockerfile index 97c955d..a1fb759 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,4 +13,4 @@ WORKDIR /app EXPOSE 5000 -RUN make babel-update-mo +RUN BIN_PREFIX=/usr/local/bin make babel-update-mo diff --git a/Makefile b/Makefile index 594e2f3..85dfd00 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,7 @@ PYTEST_COV_ARGS = +BIN_PREFIX ?= venv/bin + FORCE: ; create-venv: @@ -44,11 +46,11 @@ test_logging: venv/bin/pytest --capture=sys --log-cli-level=DEBUG tests/base/test_logging.py babel-update-po: - venv/bin/pybabel extract -F babel.cfg -k lazy_gettext -k hardcode_text -o messages.pot app - venv/bin/pybabel update -i messages.pot -d app/translations + $(BIN_PREFIX)/pybabel extract -F babel.cfg -k lazy_gettext -k hardcode_text -o messages.pot app + $(BIN_PREFIX)/pybabel update -i messages.pot -d app/translations babel-update-mo: babel-update-po - venv/bin/pybabel compile -d app/translations + $(BIN_PREFIX)/pybabel compile -d app/translations babel-translate-po: venv/bin/python app/scripts/fill_zh_translations.py