diff options
Diffstat (limited to '.github')
| -rw-r--r-- | .github/workflows/ant-build-release.yaml | 53 | ||||
| -rw-r--r-- | .github/workflows/build-docker-image.yaml | 87 |
2 files changed, 140 insertions, 0 deletions
diff --git a/.github/workflows/ant-build-release.yaml b/.github/workflows/ant-build-release.yaml new file mode 100644 index 000000000..89d50ffcd --- /dev/null +++ b/.github/workflows/ant-build-release.yaml @@ -0,0 +1,53 @@ +name: Build GitHub Release +# This workflow builds the YaCy Search Server and creates a GitHub Release with the build artifacts. + +on: + # TODO: Currently disabled, because I'm not sure if this is the right way to do the release. + # push: + # tags: + # - "v*.*.*" + # - "Release_*" + # pull_request: + workflow_dispatch: + +permissions: + contents: write + actions: write + +jobs: + build: + strategy: + fail-fast: false + matrix: + #os: [macos-latest, ubuntu-latest, windows-latest] + os: [ubuntu-latest] + + runs-on: ${{ matrix.os }} + + steps: + - name: Check-out repository + uses: actions/checkout@v4 + + - name: Setup Java + uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: '21' + cache: 'maven' + + - name: Build + run: ant clean all dist + + - name: Upload Artifacts + uses: actions/upload-artifact@v4 + with: + name: ${{ runner.os }} ${{ runner.arch }} Build + path: RELEASE/* + + - name: Create GitHub Release + uses: softprops/action-gh-release@v2 + if: startsWith(github.ref, 'refs/tags/') + with: + draft: true + generate_release_notes: true + files: RELEASE/* diff --git a/.github/workflows/build-docker-image.yaml b/.github/workflows/build-docker-image.yaml new file mode 100644 index 000000000..15ce51f6e --- /dev/null +++ b/.github/workflows/build-docker-image.yaml @@ -0,0 +1,87 @@ +name: Build Docker Image + +on: + push: + branches: + - "**" + tags: + - "v*.*.*" + - "Release_*" + pull_request: + workflow_dispatch: + +permissions: + contents: read + packages: write + actions: write + +jobs: + docker: + strategy: + fail-fast: false + matrix: + include: + - tag: "" # Default Dockerfile + platforms: linux/amd64,linux/arm64 + - tag: alpine + platforms: linux/amd64,linux/arm64 + + runs-on: ubuntu-latest + steps: + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + # list of Docker images to use as base name for tags + # GitHub Container Registry & Docker Hub + images: | + ghcr.io/${{ github.repository }} + ${{ secrets.DOCKERHUB_USERNAME }}/${{ github.event.repository.name }} + # generate Docker tags based on the following events/attributes + flavor: | + latest=auto + prefix= + suffix=${{ matrix.tag != '' && format('-{0}', matrix.tag) || '' }},onlatest=true + tags: | + type=schedule + type=ref,event=branch + type=ref,event=pr + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} + type=semver,pattern={{major}} + type=sha + type=match,pattern=Release_(\d+\.\d+),group=1 + type=match,pattern=Release_(\d+),group=1 + + - name: Login to GitHub Container Registry + if: github.event_name != 'pull_request' + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Login to Docker Hub + if: github.event_name != 'pull_request' + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Build and push + uses: docker/build-push-action@v6 + with: + # Use "Dockerfile" if matrix.tag is empty, otherwise use "Dockerfile.{tag}" + file: docker/Dockerfile${{ matrix.tag != '' && format('.{0}', matrix.tag) || '' }} + platforms: ${{ matrix.platforms }} + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=gha + cache-to: type=gha,mode=max |
