fix: basepath #4
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, Push, and Deploy to GHCR | |
| on: | |
| push: | |
| branches: | |
| - "dockerAlternative" | |
| workflow_dispatch: | |
| env: | |
| DOCKER_BUILDKIT: 1 | |
| IMAGE_NAME: ghcr.io/aulasoftwarelibre/landingsalmorejotech2026 | |
| jobs: | |
| build-and-push: | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'push' && github.repository == 'aulasoftwarelibre/landingSalmorejoTech2026' | |
| permissions: | |
| contents: read | |
| packages: write | |
| outputs: | |
| sha_short: ${{ steps.vars.outputs.sha_short }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Get short commit SHA | |
| id: vars | |
| run: echo "sha_short=$(git rev-parse --short ${{ github.sha }})" >> $GITHUB_OUTPUT | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v1 | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Build and push | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| file: ./Dockerfile | |
| push: true | |
| target: landingSalmorejoTech2026 | |
| tags: | | |
| ${{ env.IMAGE_NAME }}:latest | |
| ${{ env.IMAGE_NAME }}:main | |
| ${{ env.IMAGE_NAME }}:${{ steps.vars.outputs.sha_short }} | |
| cache-from: type=local,src=/tmp/.buildx-cache | |
| cache-to: type=local,dest=/tmp/.buildx-cache,mode=max | |
| update-manifest: | |
| runs-on: ubuntu-latest | |
| needs: build-and-push | |
| steps: | |
| - name: Checkout config repository (aulasoftwarelibre/charts) | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: aulasoftwarelibre/charts | |
| path: charts | |
| token: ${{ secrets.CHARTS_REPO_PAT }} | |
| - name: Update image tag in frontend-deployment.yaml | |
| run: | | |
| sed -i 's|image: ${{ env.IMAGE_NAME }}:.*|image: ${{ env.IMAGE_NAME }}:${{ needs.build-and-push.outputs.sha_short }}|g' charts/landingsalmorejotech2026/frontend-deployment.yaml | |
| - name: Commit and push changes | |
| run: | | |
| cd charts | |
| git config --global user.name "github-actions[bot]" | |
| git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
| git add . | |
| if ! git diff --staged --quiet; then | |
| git commit -m "ci: Update frontend image (landingSalmorejoTech2026) to ${{ needs.build-and-push.outputs.sha_short }}" | |
| git push | |
| else | |
| echo "No changes to commit. El YAML ya estaba actualizado." | |
| fi |