Skip to content

armgit / mwmbl

Public Imported from GitHub
0

An open source, non-profit web search engine

Build PRs on push

Daoud Clarke9a6e83fb88c0
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
new file mode 100644
index 0000000..09cba98
--- /dev/null
+++ b/.github/workflows/build.yml
@@ -0,0 +1,43 @@
+name: Build and Push to GHCR
+on:
+ push:
+ branches: [ "main" ]
+ pull_request:
+ branches: [ "main" ] # Build for any PR targeting these branches
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+ permissions:
+ packages: write
+ contents: read
+ steps:
+ - uses: actions/checkout@v4
+
+ # This helper action automatically generates tags like 'pr-12', 'beta', and 'sha-xxxx'
+ - name: Docker metadata
+ id: meta
+ uses: docker/metadata-action@v5
+ with:
+ images: ghcr.io/${{ github.repository }}
+ tags: |
+ type=ref,event=branch
+ type=ref,event=pr
+ type=sha,format=long
+
+ - name: Log in to GHCR
+ uses: docker/login-action@v3
+ with:
+ registry: ghcr.io
+ username: ${{ github.actor }}
+ password: ${{ secrets.GITHUB_TOKEN }}
+
+ - name: Build and push
+ uses: docker/build-push-action@v5
+ with:
+ context: .
+ push: true
+ tags: ${{ steps.meta.outputs.tags }}
+ labels: ${{ steps.meta.outputs.labels }}
+ cache-from: type=gha
+ cache-to: type=gha,mode=max