diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e9af8a9..55b2c7b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,6 +1,6 @@ name: Test -on: [push] +on: [push, workflow_call] jobs: qa: @@ -26,25 +26,3 @@ jobs: run: pip install -r requirements-dev.txt - name: Run tests run: pytest - - publish: - runs-on: ubuntu-latest - if: github.ref == 'refs/heads/main' - needs: test - steps: - - name: Login to GitHub Container Registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Get image metadata - id: meta - uses: docker/metadata-action@v5 - with: - images: ghcr.io/${{ github.repository }} - - name: Build and push Docker image - uses: docker/build-push-action@v5 - with: - push: true - tags: ${{ steps.meta.outputs.tags }} \ No newline at end of file diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..9fc8f9b --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,26 @@ +on: [release] + +jobs: + test: + uses: ./.github/workflows/ci.yml + + publish: + runs-on: ubuntu-latest + needs: test + steps: + - name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Get image metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: ghcr.io/${{ github.repository }} + - name: Build and push Docker image + uses: docker/build-push-action@v5 + with: + push: true + tags: ${{ steps.meta.outputs.tags }} \ No newline at end of file