diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 35678ee..0c7182a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,17 +2,38 @@ name: CI on: push: - branches: [master] + branches: + - "main" + tags: + - "v*" + pull_request: + branches: + - "main" jobs: - push: + build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - uses: docker/build-push-action@v1 + + - uses: crazy-max/ghaction-docker-meta@v2 + id: meta + with: + images: intodocker/create-react-app + tags: | + type=edge,branch=main + type=semver,pattern={{version}} + type=semver,pattern={{major}} + + - uses: docker/setup-buildx-action@v1 + - uses: docker/login-action@v1 + if: github.event_name != 'pull_request' with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - repository: intodocker/create-react-app - add_git_labels: true - tags: latest + + - uses: docker/build-push-action@v2 + with: + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }}