diff --git a/.github/workflows/build-and-push-image.yml b/.github/workflows/build-and-push-image.yml new file mode 100644 index 0000000..7513261 --- /dev/null +++ b/.github/workflows/build-and-push-image.yml @@ -0,0 +1,44 @@ +name: Build and push image + +on: + push: + branches: + - master + +jobs: + build_and_push_image: + name: Build Docker image and push to registries + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + + - name: Set up Docker Buildx + id: buildx + uses: docker/setup-buildx-action@v1 + + - name: Login to DockerHub + uses: docker/login-action@v1 + with: + username: charlocharlie + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Login to GitHub Container Registry + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build and push + id: docker_build_push + uses: docker/build-push-action@v2 + with: + push: true + tags: | + charlocharlie/markov-discord:latest + ghcr.io/${{ github.repository }}:latest + ghcr.io/${{ github.repository }}:${{ github.sha }} + + - name: Image digest + run: echo ${{ steps.docker_build_push.outputs.digest }} \ No newline at end of file