|
12 | 12 | test: |
13 | 13 | name: Test |
14 | 14 | runs-on: ubuntu-latest |
| 15 | + permissions: |
| 16 | + contents: write |
15 | 17 | strategy: |
16 | 18 | matrix: |
17 | 19 | go: [1.21.x, 1.22.x, 1.23.x, 1.24.x] |
@@ -105,18 +107,37 @@ jobs: |
105 | 107 |
|
106 | 108 | - name: Build binaries |
107 | 109 | run: | |
108 | | - # Build for different platforms |
109 | | - OS = ["darwin", "freebsd", "linux", "windows"] |
110 | | - ARCH = ["amd64", "arm64"] |
| 110 | + # Set the build time environment variable |
| 111 | + BUILD_TIME=$(date -u +'%Y-%m-%dT%H:%M:%SZ') |
| 112 | +
|
| 113 | + # Add run permissions to the build script |
| 114 | + chmod +x ./scripts/build.sh |
111 | 115 |
|
112 | | - for os in OS: |
113 | | - for arch in ARCH: |
114 | | - GOOS=$os GOARCH=$arch go build -o articulate-parser-$os-$arch main.go |
| 116 | + # Display help information for the build script |
| 117 | + ./scripts/build.sh --help |
| 118 | +
|
| 119 | + # Build for all platforms |
| 120 | + ./scripts/build.sh \ |
| 121 | + --verbose \ |
| 122 | + -ldflags "-s -w -X github.com/kjanat/articulate-parser/internal/version.Version=${{ github.ref_name }} -X github.com/kjanat/articulate-parser/internal/version.BuildTime=$BUILD_TIME -X github.com/kjanat/articulate-parser/internal/version.GitCommit=${{ github.sha }}" |
| 123 | +
|
| 124 | + - name: Upload a Build Artifact |
| 125 | + |
| 126 | + with: |
| 127 | + # Artifact name |
| 128 | + name: build-artifacts # optional, default is artifact |
| 129 | + # A file, directory or wildcard pattern that describes what to upload |
| 130 | + path: build/ |
| 131 | + if-no-files-found: ignore |
| 132 | + retention-days: 1 |
| 133 | + compression-level: 9 |
| 134 | + overwrite: true |
| 135 | + include-hidden-files: true |
115 | 136 |
|
116 | 137 | - name: Create Release |
117 | 138 | uses: softprops/action-gh-release@v2 |
118 | 139 | with: |
119 | | - files: articulate-parser-* |
| 140 | + files: build/* |
120 | 141 | generate_release_notes: true |
121 | 142 | draft: false |
122 | 143 | prerelease: ${{ startsWith(github.ref, 'refs/tags/v0.') }} |
|
0 commit comments