Try to fix env #10
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 | |
| # Trigger the workflow on pushes to the main branch | |
| on: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| # Check out the repository code | |
| - name: Check out code | |
| uses: actions/checkout@v3 | |
| - name: Extract version | |
| id: vars | |
| run: echo ::set-output name=sha_short::${GITHUB_SHA::7} | |
| # Set up Go environment | |
| - name: Set up Go | |
| uses: actions/setup-go@v4 | |
| with: | |
| go-version: "1.20" | |
| # Log in to Docker Hub (if pushing to Docker Hub) | |
| - name: Log in to GitHub Container Registry | |
| uses: docker/login-action@v2 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@v4 | |
| with: | |
| context: ./src/server | |
| push: true | |
| tags: | | |
| ghcr.io/${{ github.actor }}/hit:latest | |
| ghcr.io/${{ github.actor }}/hit:${{ steps.vars.outputs.sha_short }} | |
| build-client: | |
| runs-on: ubuntu-latest | |
| steps: | |
| # Checkout the repository | |
| - uses: actions/checkout@v3 | |
| - name: Extract version | |
| id: vars | |
| run: echo ::set-output name=sha_short::${GITHUB_SHA::7} | |
| # Log in to GitHub Container Registry | |
| - name: Log in to GitHub Container Registry | |
| uses: docker/login-action@v2 | |
| with: | |
| registry: ghcr.io # Use docker.io for Docker Hub | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| # Build and push the Docker image | |
| - name: Build and Push Docker Image | |
| uses: docker/build-push-action@v4 | |
| with: | |
| context: ./src/client | |
| push: true | |
| tags: | | |
| ghcr.io/${{ github.actor }}/hit-client:latest | |
| ghcr.io/${{ github.actor }}/hit-client:${{ steps.vars.outputs.sha_short }} | |
| build-args: | | |
| VITE_BASE_URL=${{ secrets.VITE_BASE_URL }} |