Mirror from bluesky-social/pds

initial github workflow to build and push to ghcr

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