| name: Build and Push Docker Image |
|
|
| on: |
| release: |
| types: [created] |
| workflow_dispatch: |
|
|
| jobs: |
| build: |
| runs-on: ubuntu-latest |
|
|
| steps: |
| - name: Checkout repository |
| uses: actions/checkout@v3 |
|
|
| - name: List files in the repository |
| run: ls -la |
|
|
| - name: Disable Docker BuildKit |
| run: echo "DOCKER_BUILDKIT=0" >> $GITHUB_ENV |
|
|
| - name: Set up Docker Buildx |
| uses: docker/setup-buildx-action@v2 |
|
|
| - name: Log in to Docker Hub |
| uses: docker/login-action@v2 |
| with: |
| username: ${{ secrets.DOCKER_HUB_USERNAME }} |
| password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} |
|
|
| - name: Log in to GitHub Container Registry |
| uses: docker/login-action@v2 |
| with: |
| registry: ghcr.io |
| username: ${{ github.actor }} |
| password: ${{ secrets.GITHUB_TOKEN }} |
|
|
| - name: Convert GitHub username to lowercase |
| id: lowercase_username |
| run: echo "username=$(echo ${{ github.actor }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV |
|
|
| - name: Build and push to Docker Hub |
| uses: docker/build-push-action@v4 |
| with: |
| context: . |
| push: true |
| tags: ${{ secrets.DOCKER_HUB_USERNAME }}/ddg-chat-go:latest |
| platforms: linux/amd64,linux/arm64 |
| labels: | |
| version=latest |
| maintainers=https://blog.lmyself.top |
| |
| - name: Build and push to GitHub Packages |
| uses: docker/build-push-action@v4 |
| with: |
| context: . |
| push: true |
| tags: ghcr.io/${{ env.username }}/ddg-chat-go:latest |
| platforms: linux/amd64,linux/arm64 |
| labels: | |
| version=latest |
| maintainers=https://blog.lmyself.top |
| |