[fix] format #458
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: Publish Docker Image | |
| on: | |
| push: | |
| branches: ['master'] # Trigger on pushes to master branch | |
| tags: ['v*.*.*'] # Trigger on semantic version tags (e.g., v1.0.0) | |
| env: | |
| REGISTRY: ghcr.io | |
| IMAGE_NAME: ${{ github.repository_owner }}/hister # Auto-uses your GitHub username/org | |
| jobs: | |
| build-and-push: | |
| name: build and push (${{ matrix.target }}) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| include: | |
| - target: release | |
| suffix: '' | |
| - target: root | |
| suffix: '-root' | |
| - target: debug | |
| suffix: '-debug' | |
| permissions: | |
| contents: read | |
| packages: write # Required to push to GHCR | |
| steps: | |
| - name: Checkout Code | |
| uses: actions/checkout@v6 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v4 | |
| with: | |
| driver: docker-container # Required for multi-platform | |
| - name: Log in to GHCR | |
| uses: docker/login-action@v4 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} # Auto-generated, no setup needed | |
| - name: Extract Metadata (tags, labels) | |
| id: meta | |
| uses: docker/metadata-action@v6 | |
| with: | |
| images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
| flavor: | | |
| latest=false | |
| suffix=${{ matrix.suffix }},onlatest=true | |
| # tags: branch -> :master, tag -> :v1.0.0, sha → :sha-7d4a3f2, latest on tags only | |
| tags: | | |
| type=ref,event=branch | |
| type=ref,event=tag | |
| type=sha | |
| type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/') }} | |
| - name: Build and Push | |
| uses: docker/build-push-action@v7 | |
| with: | |
| context: . | |
| platforms: linux/amd64,linux/arm64 # Build for Intel + ARM | |
| target: ${{ matrix.target }} | |
| push: ${{ github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/') }} | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} |