diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6aa9170f..26080445 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -72,57 +72,4 @@ jobs: - name: Show rate limit run: | curl -sL -H "Authorization: token $GITHUB_TOKEN" -H "Accept: application/vnd.github.v3+json" https://api.github.com/rate_limit - - release-test-darwin: - name: Release assets test for maoOS - runs-on: macos-latest - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - steps: - - name: Check out source code - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Set up Go - uses: actions/setup-go@v4 - with: - go-version-file: go.mod - cache: true - - - name: Setup - run: | - brew install goreleaser - - - name: Release - run: | - goreleaser --config .goreleaser/darwin.yml --clean --snapshot --skip-publish - - release-test-linux: - name: Release assets test for Linux - runs-on: ubuntu-latest - steps: - - name: Set up gcc-aarch64-linux-gnu - run: | - sudo apt-get update - sudo apt-get install -y gcc-aarch64-linux-gnu - - - name: Check out source code - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Set up Go - uses: actions/setup-go@v4 - with: - go-version-file: go.mod - cache: true - - - name: Run GoReleaser - uses: goreleaser/goreleaser-action@v4 - with: - distribution: goreleaser - version: latest - args: release --config .goreleaser/linux.yml --clean --snapshot --skip-publish - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + diff --git a/.github/workflows/parallel.yml b/.github/workflows/parallel.yml index dbc073e1..df6cfd90 100644 --- a/.github/workflows/parallel.yml +++ b/.github/workflows/parallel.yml @@ -15,7 +15,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} steps: - name: Check out source code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up Go uses: actions/setup-go@v4 @@ -46,7 +46,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} steps: - name: Check out source code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up Go uses: actions/setup-go@v4 @@ -73,7 +73,7 @@ jobs: DEBUG: 1 steps: - name: Check out source code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up Go uses: actions/setup-go@v4 diff --git a/.github/workflows/release-test.yml b/.github/workflows/release-test.yml new file mode 100644 index 00000000..b0c6be1d --- /dev/null +++ b/.github/workflows/release-test.yml @@ -0,0 +1,95 @@ +name: release test + +on: + push: + branches: + - main + pull_request: + paths: + - .github/workflows/release-test.yml + - .goreleaser/*.yml + +jobs: + release-test-darwin: + name: Release assets test for maoOS + runs-on: macos-latest + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + steps: + - name: Check out source code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version-file: go.mod + cache: true + + - name: Run GoReleaser (dry-run) + uses: goreleaser/goreleaser-action@v5 + with: + distribution: goreleaser + version: latest + args: --config .goreleaser/darwin.yml --clean --snapshot --skip=publish + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + release-test-linux: + name: Release assets test for Linux + runs-on: ubuntu-latest + steps: + - name: Set up gcc-aarch64-linux-gnu + run: | + sudo apt-get update + sudo apt-get install -y gcc-aarch64-linux-gnu + + - name: Check out source code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version-file: go.mod + cache: true + + - name: Run GoReleaser (dry-run) + uses: goreleaser/goreleaser-action@v5 + with: + distribution: goreleaser + version: latest + args: --config .goreleaser/linux.yml --clean --snapshot --skip=publish + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + release-test-windows: + name: Release assets test for Windows + runs-on: windows-latest + steps: + - name: Use LF + run: | + git config --global core.autocrlf false + git config --global core.eol lf + + - name: Check out source code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version-file: go.mod + cache: true + + - name: Run GoReleaser (dry-run) + uses: goreleaser/goreleaser-action@v5 + with: + distribution: goreleaser + version: latest + args: --config .goreleaser/windows.yml --clean --snapshot --skip=publish + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/tagpr.yml b/.github/workflows/tagpr.yml index 61c73635..6e2a0d3a 100644 --- a/.github/workflows/tagpr.yml +++ b/.github/workflows/tagpr.yml @@ -13,7 +13,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} steps: - name: Check out source code - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up Go uses: actions/setup-go@v4 @@ -34,7 +34,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} steps: - name: Check out source code - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 @@ -44,13 +44,14 @@ jobs: go-version-file: go.mod cache: true - - name: Setup - run: | - brew install goreleaser - - - name: Release - run: | - goreleaser --config .goreleaser/darwin.yml --clean + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v5 + with: + distribution: goreleaser + version: latest + args: --config .goreleaser/darwin.yml --clean + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} release-linux: name: Release assets for Linux @@ -64,7 +65,7 @@ jobs: sudo apt-get install -y gcc-aarch64-linux-gnu - name: Check out source code - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 @@ -75,14 +76,45 @@ jobs: cache: true - name: Run GoReleaser - uses: goreleaser/goreleaser-action@v4 + uses: goreleaser/goreleaser-action@v5 with: distribution: goreleaser version: latest - args: release --config .goreleaser/linux.yml --clean + args: --config .goreleaser/linux.yml --clean env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + release-windows: + name: Release assets for Windows + needs: tagpr + if: needs.tagpr.outputs.tagpr-tag != '' + runs-on: windows-latest + steps: + - name: Use LF + run: | + git config --global core.autocrlf false + git config --global core.eol lf + + - name: Check out source code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version-file: go.mod + cache: true + + - name: Run GoReleaser + uses: goreleaser/goreleaser-action@v5 + with: + distribution: goreleaser + version: latest + args: --config .goreleaser/windows.yml --clean + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + dockerimage: needs: tagpr if: needs.tagpr.outputs.tagpr-tag != '' diff --git a/.goreleaser/windows.yml b/.goreleaser/windows.yml new file mode 100644 index 00000000..8a93c7d7 --- /dev/null +++ b/.goreleaser/windows.yml @@ -0,0 +1,38 @@ +before: + hooks: + - go mod download + - go mod tidy +builds: + - + id: octocov-windows + ldflags: + - -s -w -X github.com/k1LoW/octocov.version={{.Version}} -X github.com/k1LoW/octocov.commit={{.FullCommit}} -X github.com/k1LoW/octocov.date={{.Date}} -X github.com/k1LoW/octocov/version.Version={{.Version}} + env: + - CGO_ENABLED=1 + goos: + - windows + goarch: + - amd64 + - arm64 +archives: + - + id: octocov-archive + name_template: '{{ .ProjectName }}_v{{ .Version }}_{{ .Os }}_{{ .Arch }}{{ if .Arm }}v{{ .Arm }}{{ end }}' + format_overrides: + - goos: windows + format: zip + files: + - CREDITS + - README.md + - CHANGELOG.md +checksum: + name_template: 'checksums-windows.txt' +snapshot: + name_template: "{{ .Version }}-next" +changelog: + skip: true + sort: asc + filters: + exclude: + - '^docs:' + - '^test:'