diff --git a/.github/workflows/build-push-backend.yml b/.github/workflows/build-push-backend.yml index a11b615..0d353f4 100644 --- a/.github/workflows/build-push-backend.yml +++ b/.github/workflows/build-push-backend.yml @@ -25,6 +25,8 @@ jobs: steps: - uses: actions/checkout@v4 - uses: astral-sh/ruff-action@v3 + with: + src: "./media_manager" run-tests: needs: lint-code @@ -84,5 +86,5 @@ jobs: tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} build-args: | - VERSION=${{ steps.meta.outputs.version }} # This will be the git tag (e.g. v1.0.0) or branch name or sha + VERSION=${{ steps.meta.outputs.version }} diff --git a/.github/workflows/build-push-metadata_relay.yml b/.github/workflows/build-push-metadata_relay.yml new file mode 100644 index 0000000..81891d1 --- /dev/null +++ b/.github/workflows/build-push-metadata_relay.yml @@ -0,0 +1,66 @@ +name: Build and Push Backend Docker Image + +on: + push: + branches: + - master + tags: + - 'v*.*.*' + paths: + - 'metadata_relay/**' + - '.github/workflows/python-lint_metadata_relay.yaml' + workflow_dispatch: + +jobs: + lint-code: + name: Lint Python Code + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - uses: astral-sh/ruff-action@v3 + with: + src: "./metadata_relay" + + build-and-push: + needs: lint-code + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Log in to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}/metadata_relay + tags: | + type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', 'master') }} + type=ref,event=tag + type=ref,event=branch + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=semver,pattern={{major}} + type=sha + + - name: Build and push Docker image + uses: docker/build-push-action@v6 + with: + context: ./metadata_relay + file: ./metadata_relay/Dockerfile + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + build-args: | + VERSION=${{ steps.meta.outputs.version }} diff --git a/.github/workflows/python-lint.yaml b/.github/workflows/python-lint.yaml index 7301c16..4acbd6e 100644 --- a/.github/workflows/python-lint.yaml +++ b/.github/workflows/python-lint.yaml @@ -24,4 +24,6 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: astral-sh/ruff-action@v3 \ No newline at end of file + - uses: astral-sh/ruff-action@v3 + with: + src: "./media_manager" \ No newline at end of file diff --git a/.github/workflows/python-lint_metadata_relay.yaml b/.github/workflows/python-lint_metadata_relay.yaml new file mode 100644 index 0000000..3547bd8 --- /dev/null +++ b/.github/workflows/python-lint_metadata_relay.yaml @@ -0,0 +1,21 @@ +name: Ruff +on: + push: + branches: + - master + paths: + - 'metadata_relay/**' + - '.github/workflows/python-lint_metadata_relay.yaml' + pull_request: + paths: + - 'metadata_relay/**' + - '.github/workflows/python-lint_metadata_relay.yaml' + workflow_dispatch: +jobs: + ruff: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: astral-sh/ruff-action@v3 + with: + src: "./metadata_relay" \ No newline at end of file