Skip to content

Commit

Permalink
Merge pull request #313 from k1LoW/support-windows
Browse files Browse the repository at this point in the history
Support Windows
  • Loading branch information
k1LoW authored Jan 23, 2024
2 parents e04ca8a + dee5837 commit ef929a5
Show file tree
Hide file tree
Showing 5 changed files with 181 additions and 69 deletions.
55 changes: 1 addition & 54 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
6 changes: 3 additions & 3 deletions .github/workflows/parallel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
95 changes: 95 additions & 0 deletions .github/workflows/release-test.yml
Original file line number Diff line number Diff line change
@@ -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 }}
56 changes: 44 additions & 12 deletions .github/workflows/tagpr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand All @@ -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
Expand All @@ -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

Expand All @@ -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 != ''
Expand Down
38 changes: 38 additions & 0 deletions .goreleaser/windows.yml
Original file line number Diff line number Diff line change
@@ -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:'

0 comments on commit ef929a5

Please sign in to comment.