fix: fix binding #11
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 to GHCR | |
| on: | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - 'v*' | |
| jobs: | |
| build-and-push: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Log in to GHCR using GITHUB_TOKEN | |
| run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u ${{ github.actor }} --password-stdin | |
| - name: Extract tag or fallback to latest | |
| id: meta | |
| run: | | |
| REF=${GITHUB_REF##*/} | |
| if [[ "${GITHUB_REF}" == refs/heads/* ]]; then | |
| REF=latest | |
| fi | |
| echo "tag=$(echo "$REF" | tr '[:upper:]' '[:lower:]')" >> "$GITHUB_OUTPUT" | |
| echo "repo=$(echo "${{ github.event.repository.name }}" | tr '[:upper:]' '[:lower:]')" >> "$GITHUB_OUTPUT" | |
| echo "owner=$(echo "${{ github.repository_owner }}" | tr '[:upper:]' '[:lower:]')" >> "$GITHUB_OUTPUT" | |
| - name: Build Docker image | |
| run: | | |
| docker build -t ghcr.io/${{ steps.meta.outputs.owner }}/${{ steps.meta.outputs.repo }}:${{ steps.meta.outputs.tag }} . | |
| - name: Push Docker image | |
| run: | | |
| docker push ghcr.io/${{ steps.meta.outputs.owner }}/${{ steps.meta.outputs.repo }}:${{ steps.meta.outputs.tag }} |