diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dff13cc..5f00b85 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,8 +21,11 @@ jobs: with: go-version-file: go.mod - - name: Build - run: make compile + - name: Build for ARM64 + run: make compile-arm64 + + - name: Build for AMD64 + run: make compile-amd64 - name: Build Local Test run: make compileLocal diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d7d1237..ac16945 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -9,22 +9,34 @@ on: jobs: releases-matrix: name: Release Go Binaries - runs-on: ubuntu-latest - strategy: - matrix: - goos: [darwin] - goarch: [amd64, arm64] + runs-on: macos-latest steps: - uses: actions/checkout@v4 - - uses: wangyoucao577/go-release-action@v1.53 + - uses: actions/setup-go@v5 with: - github_token: ${{ secrets.GITHUB_TOKEN }} - goos: ${{ matrix.goos }} - goarch: ${{ matrix.goarch }} - goversion: go.mod - project_path: "./cmd/" - extra_files: README.md LICENSE - md5sum: FALSE - sha256sum: TRUE + go-version-file: go.mod + + - run: make compile + + - uses: apple-actions/import-codesign-certs@v3 + with: + p12-file-base64: ${{ secrets.CERTIFICATES_P12 }} + p12-password: ${{ secrets.CERTIFICATES_P12_PASSWORD }} + + - uses: halprin/macos-sign-package-notarize@v1 + with: + path-to-binary: ./cloud-backup + signing-identity: ${{ secrets.SIGNING_IDENTITY }} + apple-id: ${{ secrets.APPLE_ID }} + app-specific-password: ${{ secrets.APP_SPECIFIC_PASSWORD }} + apple-developer-team-id: ${{ secrets.APPLE_DEVELOPER_TEAM_ID }} + extra-files: README.md LICENSE + archive-disk-name: Cloud Backup + archive-file-path: ./cloud-backup.dmg + + - name: Upload Release Asset + run: gh release upload ${{ github.event.release.tag_name }} ./cloud-backup.dmg --clobber + env: + GH_TOKEN: ${{ github.token }} diff --git a/.gitignore b/.gitignore index ff22b96..b0fb730 100644 --- a/.gitignore +++ b/.gitignore @@ -4,8 +4,7 @@ *.dll *.so *.dylib -/cloud-backup -/cloud-backup-local +/cloud-backup* # Test binary, built with `go test -c` *.test diff --git a/Makefile b/Makefile index 1f83ecc..ef9a7b1 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,11 @@ -compile: - go build -o ./cloud-backup ./cmd/ +compile: compile-arm64 compile-amd64 + lipo -create -output cloud-backup ./cloud-backup-arm64 ./cloud-backup-amd64 + +compile-arm64: + GOOS=darwin GOARCH=arm64 go build -o ./cloud-backup-arm64 ./cmd/ + +compile-amd64: + GOOS=darwin GOARCH=amd64 go build -o ./cloud-backup-amd64 ./cmd/ compileLocal: go build -tags localDesination -o ./cloud-backup-local ./cmd/