diff --git a/.gitea/workflows/ci.yaml b/.gitea/workflows/ci.yaml index 26b3b85..2fe994c 100644 --- a/.gitea/workflows/ci.yaml +++ b/.gitea/workflows/ci.yaml @@ -34,6 +34,13 @@ jobs: build-and-package: if: always() needs: test + strategy: + matrix: + goos: [linux, windows, darwin] + goarch: [amd64, arm64] + exclude: + - goos: windows + goarch: arm64 runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -44,7 +51,17 @@ jobs: check-latest: true - name: Build binary - run: go build -ldflags="-s -w" -o ratatoskr ./cmd/ratatoskr/ + run: | + FILENAME="ratatoskr-${{ matrix.goos }}-${{ matrix.goarch }}" + if [ "${{ matrix.goos }}" = "windows" ]; then + FILENAME="${FILENAME}.exe" + fi + GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} \ + go build -ldflags="-s -w" -o "${FILENAME}" ./cmd/ratatoskr/ + echo "FILENAME=${FILENAME}" >> "${GITEA_ENV}" + + - name: Show size + run: ls -lh "$FILENAME" - name: Upload to Gitea Packages if: gitea.ref == 'refs/heads/main' @@ -53,9 +70,9 @@ jobs: curl -sS -X PUT \ -H "Authorization: token ${{ secrets.TC_GITEA_TOKEN }}" \ -H "Content-Type: application/octet-stream" \ - "${{ vars.GIT_MAIN_URL }}/api/packages/${{ gitea.actor }}/generic/ratatoskr/${VERSION}/ratatoskr" \ - --data-binary @ratatoskr - echo "Uploaded version ${VERSION}" + "${{ vars.GIT_MAIN_URL }}/api/packages/${{ gitea.actor }}/generic/ratatoskr/${VERSION}/${FILENAME}" \ + --data-binary @${FILENAME} + echo "Uploaded ${VERSION}/${FILENAME}" - name: Update latest tag if: gitea.ref == 'refs/heads/main' @@ -63,10 +80,6 @@ jobs: curl -sS -X PUT \ -H "Authorization: token ${{ secrets.TC_GITEA_TOKEN }}" \ -H "Content-Type: application/octet-stream" \ - "${{ vars.GIT_MAIN_URL }}/api/packages/${{ gitea.actor }}/generic/ratatoskr/latest/ratatoskr" \ - --data-binary @ratatoskr - echo "Updated 'latest' tag" - - - name: Store binary (PR only) - if: gitea.ref != 'refs/heads/main' - run: ls -lh ratatoskr \ No newline at end of file + "${{ vars.GIT_MAIN_URL }}/api/packages/${{ gitea.actor }}/generic/ratatoskr/latest/${FILENAME}" \ + --data-binary @${FILENAME} + echo "Updated 'latest/${FILENAME}'" \ No newline at end of file diff --git a/Makefile b/Makefile index d773755..d4b3296 100644 --- a/Makefile +++ b/Makefile @@ -35,4 +35,6 @@ bench: cross: GOOS=linux GOARCH=amd64 $(GO) build $(GOFLAGS) -o $(APP)-linux-amd64 $(CMD_DIR) GOOS=linux GOARCH=arm64 $(GO) build $(GOFLAGS) -o $(APP)-linux-arm64 $(CMD_DIR) - GOOS=darwin GOARCH=amd64 $(GO) build $(GOFLAGS) -o $(APP)-darwin-amd64 $(CMD_DIR) \ No newline at end of file + GOOS=darwin GOARCH=amd64 $(GO) build $(GOFLAGS) -o $(APP)-darwin-amd64 $(CMD_DIR) + GOOS=darwin GOARCH=arm64 $(GO) build $(GOFLAGS) -o $(APP)-darwin-arm64 $(CMD_DIR) + GOOS=windows GOARCH=amd64 $(GO) build $(GOFLAGS) -o $(APP)-windows-amd64.exe $(CMD_DIR) \ No newline at end of file