Mirror from bluesky-social/pds
at update-versions 61 lines 1.6 kB view raw
1name: build-and-push-ghcr 2on: 3 push: 4 branches: 5 - main 6 - update-versions 7 tags: 8 - v* 9env: 10 REGISTRY: ghcr.io 11 USERNAME: ${{ github.actor }} 12 PASSWORD: ${{ secrets.GITHUB_TOKEN }} 13 14 # github.repository as <account>/<repo> 15 IMAGE_NAME: ${{ github.repository }} 16 17jobs: 18 pds-container-ghcr: 19 runs-on: ubuntu-latest 20 permissions: 21 contents: read 22 packages: write 23 id-token: write 24 25 steps: 26 - name: Checkout repository 27 uses: actions/checkout@v3 28 29 - name: Setup Docker buildx 30 uses: docker/setup-buildx-action@v2 31 32 - name: Log into registry ${{ env.REGISTRY }} 33 uses: docker/login-action@v2 34 with: 35 registry: ${{ env.REGISTRY }} 36 username: ${{ env.USERNAME }} 37 password: ${{ env.PASSWORD }} 38 39 - name: Extract Docker metadata 40 id: meta 41 uses: docker/metadata-action@v5 42 with: 43 images: | 44 ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} 45 tags: | 46 type=semver,pattern={{version}} 47 type=semver,pattern={{major}}.{{minor}} 48 type=sha,format=long 49 50 - name: Build and push Docker image 51 id: build-and-push 52 uses: docker/build-push-action@v4 53 with: 54 context: . 55 push: ${{ github.event_name != 'pull_request' }} 56 platforms: linux/amd64,linux/arm64 57 file: ./Dockerfile 58 tags: ${{ steps.meta.outputs.tags }} 59 labels: ${{ steps.meta.outputs.labels }} 60 cache-from: type=gha 61 cache-to: type=gha,mode=max