chore: postgres 18 #50
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 Container | |
| on: | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - 'v*.*.*' | |
| permissions: | |
| contents: read | |
| packages: write | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.repository_owner }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract Metadata (tags, labels) for Docker | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ghcr.io/deltalaboratory/postgres-backup | |
| tags: | | |
| type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/v') }} # 'latest' tag only for versioned releases | |
| type=raw,value=development,enable=${{ github.ref == 'refs/heads/main' }} # 'development' tag for main branch | |
| type=semver,pattern={{version}} # Semantic version tag (e.g., 1.0.0) from git tags | |
| type=sha,prefix=,format=short # Short commit SHA tag for unique identification | |
| labels: | | |
| org.opencontainers.image.source=${{ github.event.repository.html_url }} | |
| org.opencontainers.image.created=${{ github.event.repository.updated_at }} | |
| org.opencontainers.image.revision=${{ github.sha }} | |
| - name: Build and Push Docker Image | |
| uses: docker/build-push-action@v6 | |
| with: | |
| push: true # Push the image to the registry | |
| platforms: linux/amd64,linux/arm64 # Build for multiple architectures | |
| tags: ${{ steps.meta.outputs.tags }} # Use tags generated by metadata-action | |
| labels: ${{ steps.meta.outputs.labels }} # Use labels generated by metadata-action | |
| cache-from: type=gha # Pull cache from GitHub Actions cache | |
| cache-to: type=gha,mode=max # Push cache to GitHub Actions cache (with max retention) 🚀 |