Add testing documentation and real API endpoint integration (#101) #10
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*.*.*' | |
| permissions: | |
| contents: write | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| goos: linux | |
| goarch: amd64 | |
| - os: ubuntu-latest | |
| goos: linux | |
| goarch: arm64 | |
| - os: macos-latest | |
| goos: darwin | |
| goarch: amd64 | |
| - os: macos-latest | |
| goos: darwin | |
| goarch: arm64 | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-go@v5 | |
| with: | |
| go-version: '1.22.x' | |
| - name: Build | |
| env: | |
| CGO_ENABLED: '0' | |
| GOOS: ${{ matrix.goos }} | |
| GOARCH: ${{ matrix.goarch }} | |
| run: | | |
| go build -tags osusergo,netgo -ldflags "-s -w -X main.version=${GITHUB_REF_NAME}" -o modfetch_${{ matrix.goos }}_${{ matrix.goarch }} ./cmd/modfetch | |
| - name: Checksum | |
| run: | | |
| shasum -a 256 modfetch_${{ matrix.goos }}_${{ matrix.goarch }} > modfetch_${{ matrix.goos }}_${{ matrix.goarch }}.sha256 | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: modfetch_${{ matrix.goos }}_${{ matrix.goarch }} | |
| path: | | |
| modfetch_${{ matrix.goos }}_${{ matrix.goarch }} | |
| modfetch_${{ matrix.goos }}_${{ matrix.goarch }}.sha256 | |
| macos_universal: | |
| needs: build | |
| runs-on: macos-latest | |
| steps: | |
| - name: Download macOS artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| # Only pull the darwin artifacts | |
| pattern: modfetch_darwin_* | |
| merge-multiple: false | |
| - name: Build macOS universal binary | |
| run: | | |
| mkdir -p modfetch_darwin_universal | |
| lipo -create \ | |
| modfetch_darwin_amd64/modfetch_darwin_amd64 \ | |
| modfetch_darwin_arm64/modfetch_darwin_arm64 \ | |
| -output modfetch_darwin_universal/modfetch_darwin_universal | |
| shasum -a 256 modfetch_darwin_universal/modfetch_darwin_universal > modfetch_darwin_universal/modfetch_darwin_universal.sha256 | |
| - name: Upload universal artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: modfetch_darwin_universal | |
| path: | | |
| modfetch_darwin_universal/modfetch_darwin_universal | |
| modfetch_darwin_universal/modfetch_darwin_universal.sha256 | |
| release: | |
| needs: [build, macos_universal] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Download artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: dist | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ github.ref_name }} | |
| name: ${{ github.ref_name }} | |
| draft: false | |
| prerelease: false | |
| # Single glob to avoid double-matching .sha256 files which caused duplicate uploads | |
| files: dist/**/modfetch_* | |