Feat/auth #21
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 devtasker docker image | |
| on: | |
| pull_request: | |
| branches: | |
| - master | |
| paths-ignore: | |
| - '*.md' | |
| - .gitignore | |
| - '**/docs/**' | |
| push: | |
| branches: | |
| - master | |
| - '**/ci**' | |
| paths-ignore: | |
| - '*.md' | |
| - .gitignore | |
| - '**/docs/**' | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v4 | |
| - name: Docker Hub Authentication | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Generate Docker tag | |
| id: tag | |
| run: | | |
| if [[ "${{ github.ref }}" == "refs/heads/master" ]]; then | |
| echo "tag=latest" >> $GITHUB_OUTPUT | |
| else | |
| echo "tag=${GITHUB_SHA::8}" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Build and Push Docker Image | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| push: true | |
| tags: | | |
| ${{ secrets.DOCKERHUB_USERNAME }}/${{ vars.DOCKER_IMAGE_NAME }}:${{ steps.tag.outputs.tag }} | |
| ${{ secrets.DOCKERHUB_USERNAME }}/${{ vars.DOCKER_IMAGE_NAME }}:${{ github.sha }} | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max |