Fix deploy sending DKIM enabled with empty key_file #21
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| env: | |
| REGISTRY: ghcr.io | |
| IMAGE_NAME: ${{ github.repository }} | |
| jobs: | |
| build-binaries: | |
| name: Build Binaries | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| include: | |
| - goos: linux | |
| goarch: amd64 | |
| - goos: linux | |
| goarch: arm64 | |
| - goos: darwin | |
| goarch: amd64 | |
| - goos: darwin | |
| goarch: arm64 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.24' | |
| - name: Build binary | |
| env: | |
| GOOS: ${{ matrix.goos }} | |
| GOARCH: ${{ matrix.goarch }} | |
| CGO_ENABLED: 0 | |
| run: | | |
| VERSION=${GITHUB_REF_NAME#v} | |
| BUILD_TIME=$(date -u '+%Y-%m-%d_%H:%M:%S') | |
| COMMIT=${GITHUB_SHA::8} | |
| go build -ldflags "-s -w -X main.version=${VERSION} -X main.commit=${COMMIT} -X main.buildTime=${BUILD_TIME}" \ | |
| -o sendry-${{ matrix.goos }}-${{ matrix.goarch }} ./cmd/sendry | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: binary-${{ matrix.goos }}-${{ matrix.goarch }} | |
| path: sendry-${{ matrix.goos }}-${{ matrix.goarch }} | |
| build-web: | |
| name: Build Sendry Web | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| include: | |
| - goarch: amd64 | |
| platform: linux/amd64 | |
| - goarch: arm64 | |
| platform: linux/arm64 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up QEMU | |
| if: matrix.goarch == 'arm64' | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Build sendry-web | |
| run: | | |
| VERSION=${GITHUB_REF_NAME#v} | |
| BUILD_TIME=$(date -u '+%Y-%m-%d_%H:%M:%S') | |
| COMMIT=${GITHUB_SHA::8} | |
| LDFLAGS="-s -w -linkmode external -extldflags '-static' -X main.version=${VERSION} -X main.commit=${COMMIT} -X main.buildTime=${BUILD_TIME}" | |
| docker run --rm --platform ${{ matrix.platform }} \ | |
| -v ${{ github.workspace }}:/app -w /app \ | |
| golang:1.24-alpine \ | |
| sh -c "apk add --no-cache gcc musl-dev && \ | |
| CGO_ENABLED=1 go build -buildvcs=false -ldflags \"${LDFLAGS}\" -o sendry-web-linux-${{ matrix.goarch }} ./cmd/sendry-web" | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: web-linux-${{ matrix.goarch }} | |
| path: sendry-web-linux-${{ matrix.goarch }} | |
| build-packages: | |
| name: Build Packages | |
| runs-on: ubuntu-latest | |
| needs: [build-binaries, build-web] | |
| strategy: | |
| matrix: | |
| arch: [amd64, arm64] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Download sendry binary | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: binary-linux-${{ matrix.arch }} | |
| path: artifacts/ | |
| - name: Download sendry-web binary | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: web-linux-${{ matrix.arch }} | |
| path: artifacts/ | |
| - name: Prepare binaries | |
| run: | | |
| mkdir -p build | |
| mv artifacts/sendry-linux-${{ matrix.arch }} build/sendry-linux-${{ matrix.arch }} | |
| mv artifacts/sendry-web-linux-${{ matrix.arch }} build/sendry-web-linux-${{ matrix.arch }} | |
| chmod +x build/sendry-linux-${{ matrix.arch }} | |
| chmod +x build/sendry-web-linux-${{ matrix.arch }} | |
| - name: Install nfpm | |
| run: | | |
| go install github.com/goreleaser/nfpm/v2/cmd/nfpm@latest | |
| echo "$HOME/go/bin" >> $GITHUB_PATH | |
| - name: Prepare nfpm config | |
| run: | | |
| VERSION=${GITHUB_REF_NAME#v} | |
| sed "s/\${ARCH}/${{ matrix.arch }}/g; s/\${VERSION}/${VERSION}/g" nfpm.yaml > nfpm-${{ matrix.arch }}.yaml | |
| - name: Build DEB package | |
| run: | | |
| mkdir -p packages | |
| nfpm package --config nfpm-${{ matrix.arch }}.yaml --packager deb --target packages/ | |
| - name: Build RPM package | |
| run: nfpm package --config nfpm-${{ matrix.arch }}.yaml --packager rpm --target packages/ | |
| - name: Build APK package | |
| run: nfpm package --config nfpm-${{ matrix.arch }}.yaml --packager apk --target packages/ | |
| - name: Upload packages | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: packages-${{ matrix.arch }} | |
| path: packages/ | |
| build-docker: | |
| name: Build Docker Image | |
| runs-on: ubuntu-latest | |
| needs: [build-binaries, build-web] | |
| permissions: | |
| contents: read | |
| packages: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Download linux amd64 binary | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: binary-linux-amd64 | |
| path: artifacts/amd64/ | |
| - name: Download linux arm64 binary | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: binary-linux-arm64 | |
| path: artifacts/arm64/ | |
| - name: Download sendry-web linux amd64 binary | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: web-linux-amd64 | |
| path: artifacts/web-amd64/ | |
| - name: Download sendry-web linux arm64 binary | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: web-linux-arm64 | |
| path: artifacts/web-arm64/ | |
| - name: Prepare binaries | |
| run: | | |
| mkdir -p build | |
| mv artifacts/amd64/sendry-linux-amd64 build/sendry-linux-amd64 | |
| mv artifacts/arm64/sendry-linux-arm64 build/sendry-linux-arm64 | |
| mv artifacts/web-amd64/sendry-web-linux-amd64 build/sendry-web-linux-amd64 | |
| mv artifacts/web-arm64/sendry-web-linux-arm64 build/sendry-web-linux-arm64 | |
| chmod +x build/* | |
| ls -la build/ | |
| - name: Set up QEMU | |
| uses: docker/setup-qemu-action@v3 | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| - name: Login to GitHub Container Registry | |
| uses: docker/login-action@v3 | |
| with: | |
| registry: ${{ env.REGISTRY }} | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Extract metadata | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | |
| tags: | | |
| type=semver,pattern={{version}} | |
| type=semver,pattern={{major}}.{{minor}} | |
| type=semver,pattern={{major}} | |
| type=raw,value=latest,enable={{is_default_branch}} | |
| - name: Build and push | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| file: Dockerfile.ci | |
| platforms: linux/amd64,linux/arm64 | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| labels: ${{ steps.meta.outputs.labels }} | |
| release: | |
| name: Create Release | |
| runs-on: ubuntu-latest | |
| needs: [build-binaries, build-web, build-packages, build-docker] | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Download binary artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| pattern: binary-* | |
| path: artifacts/ | |
| - name: Download web artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| pattern: web-* | |
| path: artifacts/ | |
| - name: Download package artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| pattern: packages-* | |
| path: artifacts/ | |
| - name: Prepare release files | |
| run: | | |
| mkdir -p release | |
| # Binaries | |
| for dir in artifacts/binary-*; do | |
| if [ -d "$dir" ]; then | |
| cp "$dir"/* release/ | |
| fi | |
| done | |
| # Web binaries | |
| for dir in artifacts/web-*; do | |
| if [ -d "$dir" ]; then | |
| cp "$dir"/* release/ | |
| fi | |
| done | |
| # Packages | |
| for dir in artifacts/packages-*; do | |
| if [ -d "$dir" ]; then | |
| cp "$dir"/* release/ | |
| fi | |
| done | |
| # Create checksums | |
| cd release | |
| sha256sum * > checksums.txt | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| files: release/* | |
| generate_release_notes: true | |
| draft: false | |
| prerelease: ${{ contains(github.ref_name, '-rc') || contains(github.ref_name, '-beta') || contains(github.ref_name, '-alpha') }} |