diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index 7351105c..0460f965 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -1,50 +1,22 @@ -name: Docker +name: Publish Docker Image for Release on: - push: - # Publish `master` as Docker `latest` image. - branches: - - master - - # Publish `v1.2.3` tags as releases. - tags: - - v* - - # Run tests for any PRs. - pull_request: - + release: + types: [released] + env: IMAGE_NAME: tabpy jobs: - # Run tests. - # See also https://docs.docker.com/docker-hub/builds/automated-testing/ - test: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - - name: Run tests - run: | - if [ -f docker-compose.test.yml ]; then - docker-compose --file docker-compose.test.yml build - docker-compose --file docker-compose.test.yml run sut - else - docker build . --file Dockerfile - fi - # Push image to GitHub Packages. # See also https://docs.docker.com/docker-hub/builds/ + name: Push Docker image to GitHub Packages push: - # Ensure test job passes before pushing image. - needs: test - runs-on: ubuntu-latest - if: github.event_name == 'push' steps: - - uses: actions/checkout@v2 + - name: Checkout the repo + uses: actions/checkout@v2 - name: Build image run: docker build . --file Dockerfile --tag $IMAGE_NAME