minor bad changes #5
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
| # yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json | |
| # https://docs.github.com/en/actions/publishing-packages/publishing-docker-images | |
| name: Docker | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| branches: | |
| - main | |
| env: | |
| REGISTRY: ghcr.io | |
| IMAGE_NAME: ${{ github.repository }} | |
| jobs: | |
| publish_docker: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - name: Checkout del codice | |
| uses: actions/checkout@v4 | |
| # Setup Docker Buildx | |
| - name: Setup Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| # Login to registry | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| # Extraction metadatas | |
| - name: Extract metadata | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
| tags: | | |
| # Versione completa: v1.2.3 | |
| type=semver,pattern={{version}} | |
| # Versione major.minor: v1.2 | |
| type=semver,pattern={{major}}.{{minor}} | |
| # Solo major: v1 | |
| type=semver,pattern={{major}} | |
| # Tag 'latest' per l'ultima versione stabile | |
| type=raw,value=latest,enable={{is_default_branch}} | |
| # Build e push dell'immagine Docker | |
| - name: Build and push Docker image | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| file: ./OutdoorzMedia.WebApi/Dockerfile | |
| # Multi-platform build | |
| platforms: linux/amd64,linux/arm64 | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| # Cache for speeding up builds | |
| cache-from: type=gha | |
| cache-to: type=gha,mode=max |