This repository was archived by the owner on Oct 22, 2025. It is now read-only.
release v0.1.0 (#18) #14
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: | |
| - '**' | |
| jobs: | |
| build-and-push: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Extract branch name | |
| shell: bash | |
| run: echo "BRANCH_NAME=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV | |
| - name: Set Docker tag | |
| run: | | |
| if [ "${{ env.BRANCH_NAME }}" = "master" ]; then | |
| echo "DOCKER_TAG=latest" >> $GITHUB_ENV | |
| else | |
| # Replace forward slashes with hyphens in branch name | |
| SAFE_BRANCH_NAME=$(echo "${{ env.BRANCH_NAME }}" | sed 's/\//-/g') | |
| echo "DOCKER_TAG=prerelease-${SAFE_BRANCH_NAME}" >> $GITHUB_ENV | |
| fi | |
| - name: Build and push | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| push: true | |
| tags: ${{ vars.DOCKER_REPO }}/maxit-frontend:${{ env.DOCKER_TAG }} | |
| cache-from: type=registry,ref=${{ vars.DOCKER_REPO }}/maxit-frontend:buildcache | |
| cache-to: type=registry,ref=${{ vars.DOCKER_REPO }}/maxit-frontend:buildcache,mode=max |