diff --git a/.github/workflows/docker-package.yaml b/.github/workflows/docker-package.yaml index aa2b74b..7deccda 100644 --- a/.github/workflows/docker-package.yaml +++ b/.github/workflows/docker-package.yaml @@ -14,18 +14,22 @@ jobs: steps: - uses: actions/checkout@v2 - - - name: Build an image with a tag - run: docker build -t app -f docker/bot.Dockerfile . + - uses: docker/setup-buildx-action@v1 - name: Log into the registry - run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} - - name: Push the image - run: | - IMAGE_ID=docker.pkg.github.com/${{ github.repository }}/$IMAGE_NAME - VERSION=$(echo "${{ github.ref }}" | sed -e 's,.*/\(.*\),\1,') - [[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//') - [ "$VERSION" == "master" ] && VERSION=latest - docker tag app $IMAGE_ID:$VERSION - docker push $IMAGE_ID:$VERSION + - name: Build and push + id: docker_build + uses: docker/build-push-action@v2 + with: + context: . + file: docker/bot.Dockerfile + tags: | + ghcr.io/${{ github.repository_owner }}/${{ github.repository }}:latest + ghcr.io/${{ github.repository_owner }}/${{ github.repository }}:${{ github.event.release.tag_name }} + push: true