|
6 | 6 | - 'v*' |
7 | 7 | workflow_dispatch: |
8 | 8 |
|
9 | | -env: |
10 | | - FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true |
11 | | - DIAG_DIR: /tmp/ctk-diagnostics |
12 | | - |
13 | 9 | jobs: |
14 | 10 | goreleaser: |
15 | 11 | runs-on: ubuntu-latest |
16 | 12 | timeout-minutes: 60 |
17 | 13 | steps: |
18 | 14 | - name: Checkout |
19 | | - uses: actions/checkout@v4 |
| 15 | + uses: actions/checkout@v5 |
20 | 16 | with: |
21 | 17 | fetch-depth: 0 |
22 | 18 |
|
23 | 19 | - name: Set up Go |
24 | | - uses: actions/setup-go@v5 |
| 20 | + uses: actions/setup-go@v6 |
25 | 21 | with: |
26 | | - go-version-file: go.mod |
| 22 | + go-version: 1.25.5 |
27 | 23 | cache: true |
28 | 24 | cache-dependency-path: go.sum |
29 | 25 |
|
30 | | - - name: Collect context |
31 | | - run: | |
32 | | - set -euxo pipefail |
33 | | - mkdir -p "$DIAG_DIR" |
34 | | - { |
35 | | - echo "date=$(date -u '+%Y-%m-%dT%H:%M:%SZ')" |
36 | | - echo "github_ref=${GITHUB_REF}" |
37 | | - echo "github_ref_name=${GITHUB_REF_NAME}" |
38 | | - echo "github_sha=${GITHUB_SHA}" |
39 | | - echo "runner_os=${RUNNER_OS}" |
40 | | - echo "runner_arch=${RUNNER_ARCH}" |
41 | | - echo "pwd=$(pwd)" |
42 | | - } | tee "$DIAG_DIR/context.txt" |
43 | | - git status --short | tee "$DIAG_DIR/git-status.txt" |
44 | | - git rev-parse HEAD | tee "$DIAG_DIR/git-head.txt" |
45 | | - git tag --points-at HEAD | tee "$DIAG_DIR/git-head-tags.txt" |
46 | | - git show --stat --summary --pretty=fuller HEAD | tee "$DIAG_DIR/git-head-summary.txt" |
47 | | - go version | tee "$DIAG_DIR/go-version.txt" |
48 | | - go env | tee "$DIAG_DIR/go-env.txt" |
49 | | - sha256sum go.mod go.sum | tee "$DIAG_DIR/go-files.sha256" |
50 | | - sed -n '1,220p' go.mod | tee "$DIAG_DIR/go.mod.txt" |
51 | | - sed -n '1,220p' .github/conf/.goreleaser.yml | tee "$DIAG_DIR/goreleaser.yml.txt" |
52 | | -
|
53 | | - - name: Warm module cache |
54 | | - run: | |
55 | | - set -euxo pipefail |
56 | | - go mod download |
57 | | - go mod verify |
58 | | - go list -m all | tee "$DIAG_DIR/go-list-m-all.txt" |
59 | | - go list -m -json all > "$DIAG_DIR/go-list-m-all.json" |
60 | | - go mod graph | tee "$DIAG_DIR/go-mod-graph.txt" |
61 | | - go list -deps -f '{{if not .Standard}}{{.ImportPath}}{{end}}' ./cmd/main.go | sort | tee "$DIAG_DIR/go-list-deps-main.txt" |
62 | | - go list -deps -json ./cmd/main.go > "$DIAG_DIR/go-list-deps-main.json" |
63 | | -
|
64 | | - - name: Warm build cache |
65 | | - run: | |
66 | | - set -euxo pipefail |
67 | | - go build -trimpath -ldflags "-s -w" -o /tmp/ctk ./cmd/main.go |
68 | | - ls -lh /tmp/ctk | tee "$DIAG_DIR/warm-build-ls.txt" |
69 | | - file /tmp/ctk | tee "$DIAG_DIR/warm-build-file.txt" |
70 | | - sha256sum /tmp/ctk | tee "$DIAG_DIR/warm-build.sha256" |
71 | | - go version -m /tmp/ctk | tee "$DIAG_DIR/warm-build-go-version-m.txt" |
72 | | - go tool buildid /tmp/ctk | tee "$DIAG_DIR/warm-build-buildid.txt" |
73 | | - (size /tmp/ctk || true) | tee "$DIAG_DIR/warm-build-size.txt" |
74 | | -
|
75 | 26 | - name: Run GoReleaser |
76 | 27 | uses: goreleaser/goreleaser-action@v6 |
77 | 28 | with: |
|
80 | 31 | args: release -f .github/conf/.goreleaser.yml --clean --parallelism 1 --verbose |
81 | 32 | env: |
82 | 33 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
83 | | - |
84 | | - - name: Inspect dist |
85 | | - if: always() |
86 | | - run: | |
87 | | - set -euxo pipefail |
88 | | - if [ -d dist ]; then |
89 | | - ls -la dist/ | tee "$DIAG_DIR/dist-root.txt" |
90 | | - find dist -maxdepth 2 -type f | sort | tee "$DIAG_DIR/dist-files.txt" |
91 | | - find dist -maxdepth 2 -type f -exec ls -lh {} + | tee "$DIAG_DIR/dist-ls.txt" |
92 | | - find dist -maxdepth 2 -type f -exec file {} + | tee "$DIAG_DIR/dist-file.txt" |
93 | | - find dist -maxdepth 2 -type f -exec sha256sum {} + | tee "$DIAG_DIR/dist.sha256" |
94 | | - for f in $(find dist -maxdepth 2 -type f -name 'ctk*' 2>/dev/null | sort); do |
95 | | - echo "=== $f ===" | tee -a "$DIAG_DIR/dist-binaries.txt" |
96 | | - ls -lh "$f" | tee -a "$DIAG_DIR/dist-binaries.txt" |
97 | | - file "$f" | tee -a "$DIAG_DIR/dist-binaries.txt" |
98 | | - go tool buildid "$f" | tee -a "$DIAG_DIR/dist-binaries.txt" || true |
99 | | - go version -m "$f" | tee -a "$DIAG_DIR/dist-binaries.txt" || true |
100 | | - (size "$f" || true) | tee -a "$DIAG_DIR/dist-binaries.txt" |
101 | | - done |
102 | | - du -sh dist | tee "$DIAG_DIR/dist-size.txt" |
103 | | - sed -n '1,240p' dist/artifacts.json | tee "$DIAG_DIR/dist-artifacts.json.txt" || true |
104 | | - sed -n '1,240p' dist/checksums.txt | tee "$DIAG_DIR/dist-checksums.txt" || true |
105 | | - else |
106 | | - echo "dist directory missing" | tee "$DIAG_DIR/dist-missing.txt" |
107 | | - fi |
108 | | -
|
109 | | - - name: Compare linux amd64 output |
110 | | - if: always() |
111 | | - run: | |
112 | | - set -euxo pipefail |
113 | | - TARGET="dist/ctk_linux_amd64_v1/ctk" |
114 | | - if [ -f /tmp/ctk ] && [ -f "$TARGET" ]; then |
115 | | - ls -lh /tmp/ctk "$TARGET" | tee "$DIAG_DIR/compare-linux-amd64-ls.txt" |
116 | | - sha256sum /tmp/ctk "$TARGET" | tee "$DIAG_DIR/compare-linux-amd64.sha256" |
117 | | - cmp -s /tmp/ctk "$TARGET" && echo "identical=true" | tee "$DIAG_DIR/compare-linux-amd64-cmp.txt" || echo "identical=false" | tee "$DIAG_DIR/compare-linux-amd64-cmp.txt" |
118 | | - else |
119 | | - echo "linux amd64 artifact missing" | tee "$DIAG_DIR/compare-linux-amd64-cmp.txt" |
120 | | - fi |
121 | | -
|
122 | | - - name: Inspect GitHub release assets |
123 | | - if: always() |
124 | | - env: |
125 | | - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
126 | | - run: | |
127 | | - set -euxo pipefail |
128 | | - if gh release view "${GITHUB_REF_NAME}" --json tagName,name,isDraft,isImmutable,isPrerelease,assets > "$DIAG_DIR/release-assets.json"; then |
129 | | - cat "$DIAG_DIR/release-assets.json" |
130 | | - jq -r ' |
131 | | - [ |
132 | | - .tagName, |
133 | | - .name, |
134 | | - (.isDraft|tostring), |
135 | | - (.isPrerelease|tostring), |
136 | | - (.isImmutable|tostring) |
137 | | - ] | @tsv |
138 | | - ' "$DIAG_DIR/release-assets.json" | tee "$DIAG_DIR/release-summary.tsv" |
139 | | - jq -r ' |
140 | | - .assets[] |
141 | | - | [ |
142 | | - .name, |
143 | | - (.size|tostring), |
144 | | - .contentType, |
145 | | - .state, |
146 | | - .updatedAt, |
147 | | - (.downloadCount|tostring), |
148 | | - .url |
149 | | - ] | @tsv |
150 | | - ' "$DIAG_DIR/release-assets.json" | tee "$DIAG_DIR/release-assets.tsv" |
151 | | - else |
152 | | - echo "release assets unavailable" | tee "$DIAG_DIR/release-assets-missing.txt" |
153 | | - fi |
154 | | -
|
155 | | - - name: Upload diagnostics |
156 | | - if: always() |
157 | | - run: | |
158 | | - set -euxo pipefail |
159 | | - if [ -d "$DIAG_DIR" ]; then |
160 | | - find "$DIAG_DIR" -maxdepth 1 -type f | sort | tee "$DIAG_DIR/diag-files.txt" |
161 | | - find "$DIAG_DIR" -maxdepth 1 -type f -exec ls -lh {} + | tee "$DIAG_DIR/diag-files-ls.txt" |
162 | | - find "$DIAG_DIR" -maxdepth 1 -type f | wc -l | tee "$DIAG_DIR/diag-file-count.txt" |
163 | | - du -sh "$DIAG_DIR" | tee "$DIAG_DIR/diag-dir-size.txt" |
164 | | - else |
165 | | - echo "diagnostics directory missing" |
166 | | - fi |
167 | | - - name: Upload diagnostics artifact |
168 | | - if: always() |
169 | | - uses: actions/upload-artifact@v4 |
170 | | - with: |
171 | | - name: build-diagnostics-${{ github.ref_name }} |
172 | | - path: /tmp/ctk-diagnostics |
173 | | - if-no-files-found: warn |
0 commit comments