fix: squid start #5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build and Push Docker Image | |
| on: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| build-and-push: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v2 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v1 | |
| - name: Log in to Docker Hub | |
| uses: docker/login-action@v1 | |
| with: | |
| username: ${{ secrets.DOCKER_USERNAME }} | |
| password: ${{ secrets.DOCKER_PASSWORD }} | |
| - name: Extract repository name | |
| id: extract_repo_name | |
| run: echo "REPO_NAME=$(echo $GITHUB_REPOSITORY | cut -d'/' -f2)" >> $GITHUB_ENV | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@v2 | |
| with: | |
| context: . | |
| push: true | |
| tags: ${{ secrets.DOCKER_USERNAME }}/${{ env.REPO_NAME }}:latest | |
| - name: Create or update GitHub Release | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| TIMESTAMP=$(date -u +"%Y%m%d-%H%M%S") | |
| RELEASE_TAG="${{ env.REPO_NAME }}-$TIMESTAMP" | |
| RELEASE_NAME="Build $TIMESTAMP" | |
| RELEASE_BODY="Docker image built and pushed successfully. | |
| Image: ${{ secrets.DOCKER_USERNAME }}/${{ env.REPO_NAME }}:latest" | |
| gh release create "$RELEASE_TAG" \ | |
| --title "$RELEASE_NAME" \ | |
| --notes "$RELEASE_BODY" |