diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml index a78c0c4..134d23b 100644 --- a/.gitea/workflows/build.yaml +++ b/.gitea/workflows/build.yaml @@ -1,72 +1,72 @@ -name: Generic zig build -on: - workflow_dispatch: - push: - branches: - - '*' -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - uses: mlugg/setup-zig@v1.2.1 - with: - version: 0.14.0 - - uses: https://github.com/elerch/zig-action-cache@v1.1.6 - - name: Build project - run: zig build --summary all - - name: Run tests - run: zig build test --summary all - - name: Run tests (release mode) - run: zig build -Doptimize=ReleaseSafe -Dtarget=x86_64-linux test --summary all - - name: Package for release - run: zig build -Doptimize=ReleaseSafe -Dtarget=x86_64-linux - - name: Publish build - run: | - curl --user ${{ github.actor }}:${{ secrets.PACKAGE_PUSH }} \ - --upload-file zig-out/bin/syncthing_events \ - https://git.lerch.org/api/packages/lobo/generic/aws-sdk-with-models/${{ github.sha }}/syncthing_events-x86_64-linux-${{ github.sha }} - - name: Prepare docker image - run: zig build docker - - name: Docker meta - id: meta - uses: docker/metadata-action@v5 - with: - # list of Docker images to use as base name for tags - images: | - git.lerch.org/&{{ github.repository }} - # generate Docker tags based on the following events/attributes - 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 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - name: Log in to Gitea Container Registry - uses: docker/login-action@v3 - with: - registry: git.lerch.org - username: ${{ github.actor }} - password: ${{ secrets.PACKAGE_PUSH }} - - name: Build and push - uses: docker/build-push-action@v6 - with: - context: zig-out - platforms: linux/amd64,linux/arm64,linux/riscv64,linux/ppc64le,linux/s390x,linux/386,linux/arm/v7,linux/arm/v6 - # load: true # will not work for multiplatform - push: true - tags: ${{ steps.meta.outputs.tags }} - annotations: ${{ steps.meta.outputs.annotations }} - - name: Notify - uses: https://github.com/elerch/action-notify-ntfy@v2.github - if: always() && env.GITEA_ACTIONS == 'true' - with: - host: ${{ secrets.NTFY_HOST }} - topic: ${{ secrets.NTFY_TOPIC }} - status: ${{ job.status }} - user: ${{ secrets.NTFY_USER }} - password: ${{ secrets.NTFY_PASSWORD }} +name: Generic zig build +on: + workflow_dispatch: + push: + branches: + - '*' +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: https://github.com/mlugg/setup-zig@v1.2.1 + with: + version: 0.14.0 + - uses: https://github.com/elerch/zig-action-cache@v1.1.6 + - name: Build project + run: zig build --summary all + - name: Run tests + run: zig build test --summary all + - name: Run tests (release mode) + run: zig build -Doptimize=ReleaseSafe -Dtarget=x86_64-linux test --summary all + - name: Package for release + run: zig build -Doptimize=ReleaseSafe -Dtarget=x86_64-linux + - name: Publish build + run: | + curl --user ${{ github.actor }}:${{ secrets.PACKAGE_PUSH }} \ + --upload-file zig-out/bin/syncthing_events \ + https://git.lerch.org/api/packages/lobo/generic/aws-sdk-with-models/${{ github.sha }}/syncthing_events-x86_64-linux-${{ github.sha }} + - name: Prepare docker image + run: zig build docker + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + # list of Docker images to use as base name for tags + images: | + git.lerch.org/&{{ github.repository }} + # generate Docker tags based on the following events/attributes + 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 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Log in to Gitea Container Registry + uses: docker/login-action@v3 + with: + registry: git.lerch.org + username: ${{ github.actor }} + password: ${{ secrets.PACKAGE_PUSH }} + - name: Build and push + uses: docker/build-push-action@v6 + with: + context: zig-out + platforms: linux/amd64,linux/arm64,linux/riscv64,linux/ppc64le,linux/s390x,linux/386,linux/arm/v7,linux/arm/v6 + # load: true # will not work for multiplatform + push: true + tags: ${{ steps.meta.outputs.tags }} + annotations: ${{ steps.meta.outputs.annotations }} + - name: Notify + uses: https://github.com/elerch/action-notify-ntfy@v2.github + if: always() && env.GITEA_ACTIONS == 'true' + with: + host: ${{ secrets.NTFY_HOST }} + topic: ${{ secrets.NTFY_TOPIC }} + status: ${{ job.status }} + user: ${{ secrets.NTFY_USER }} + password: ${{ secrets.NTFY_PASSWORD }}