diff --git a/.github/workflows/docker-images-with-tags.yml b/.github/workflows/docker-images-with-tags.yml deleted file mode 100644 index 77089d6..0000000 --- a/.github/workflows/docker-images-with-tags.yml +++ /dev/null @@ -1,47 +0,0 @@ -name: Backup-zen Docker Image CI tags - -on: - push: - tags: - - '*' - -jobs: - build: - runs-on: ubuntu-latest - steps: - - - name: Checkout - uses: actions/checkout@v3 - - - name: Login to Docker Hub - uses: docker/login-action@v2 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 - - - name: Build and push PostgreSQL-Backup-Zen - uses: docker/build-push-action@v4 - with: - context: ./docker/pg - file: ./docker/pg/Dockerfile - push: true - tags: rezachalak/bzen-pg:${{ github.ref_name }} - - - name: Build and push MongoDB-Backup-Zen - uses: docker/build-push-action@v4 - with: - context: ./docker/mongo - file: ./docker/mongo/Dockerfile - push: true - tags: rezachalak/bzen-mongo:${{ github.ref_name }} - - - name: Build and push MySQL-Backup-Zen - uses: docker/build-push-action@v4 - with: - context: ./docker/mysql - file: ./docker/mysql/Dockerfile - push: true - tags: rezachalak/bzen-mysql:${{ github.ref_name }} diff --git a/.github/workflows/docker-push.yml b/.github/workflows/docker-push.yml new file mode 100644 index 0000000..5fc8ac0 --- /dev/null +++ b/.github/workflows/docker-push.yml @@ -0,0 +1,54 @@ +name: Build and Push Image +on: + release: + types: [released] + +jobs: + build: + name: Build and push image + runs-on: ubuntu-20.04 + + steps: + - uses: actions/checkout@v2 + + - name: Build Image of PostgreSQL-Backup-Zen + id: build-image + uses: redhat-actions/buildah-build@v2 + with: + image: rezachalak/bzen-pg + tags: latest ${{ github.sha }} ${{ github.event.release.tag_name }} + dockerfiles: | + ./docker/pg/Dockerfile + + - name: Build Image of MongoDB-Backup-Zen + id: build-image + uses: redhat-actions/buildah-build@v2 + with: + image: rezachalak/bzen-mongo + tags: latest ${{ github.sha }} ${{ github.event.release.tag_name }} + dockerfiles: | + ./docker/mongo/Dockerfile + + - name: Build Image of MySQL-Backup-Zen + id: build-image + uses: redhat-actions/buildah-build@v2 + with: + image: rezachalak/bzen-mysql + tags: latest ${{ github.sha }} ${{ github.event.release.tag_name }} + dockerfiles: | + ./docker/mysql/Dockerfile + + # Podman Login action (https://github.com/redhat-actions/podman-login) also be used to log in, + # in which case 'username' and 'password' can be omitted. + - name: Push To dhub + id: push-to-dhub + uses: redhat-actions/push-to-registry@v2 + with: + image: ${{ steps.build-image.outputs.image }} + tags: ${{ steps.build-image.outputs.tags }} + registry: docker.io + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_PASSWORD }} + + - name: Print image url + run: echo "Image pushed to ${{ steps.push-to-dhub.outputs.registry-paths }}" \ No newline at end of file