1- name : Homebrew Release
1+ name : Release
22
33on :
44 push :
@@ -19,10 +19,15 @@ jobs:
1919 include :
2020 - os : macos-14
2121 arch : arm64
22- - os : macos-15-large
22+ platform : apple-darwin
23+ - os : ubuntu-latest
2324 arch : x86_64
25+ platform : linux
26+ - os : windows-latest
27+ arch : x86_64
28+ platform : windows
2429
25- name : build-${{ matrix.arch }}
30+ name : build-${{ matrix.arch }}-${{ matrix.platform }}
2631 runs-on : ${{ matrix.os }}
2732
2833 steps :
@@ -60,28 +65,40 @@ jobs:
6065 cabal update
6166 cabal build exe:elm-format -O2
6267
63- - name : Package binary
68+ - name : Package binary (unix)
69+ if : runner.os != 'Windows'
6470 run : |
6571 BIN=$(cabal -v0 list-bin elm-format)
66- echo "Binary at: $BIN"
67- ls -la "$BIN" || true
68- # If cabal list-bin gives wrong path, find it
6972 if [ ! -f "$BIN" ]; then
7073 BIN=$(find dist-newstyle -name elm-format -type f -perm +111 | head -1)
71- echo "Found binary at: $BIN"
7274 fi
7375 mkdir staging
7476 cp "$BIN" staging/elm-format
7577 strip staging/elm-format
7678 TAG=${GITHUB_REF_NAME}
77- TARBALL="elm-format-${TAG}-${{ matrix.arch }}-apple-darwin .tar.gz"
79+ TARBALL="elm-format-${TAG}-${{ matrix.arch }}-${{ matrix.platform }} .tar.gz"
7880 tar -czf "$TARBALL" -C staging elm-format
7981 echo "TARBALL=$TARBALL" >> $GITHUB_ENV
8082
83+ - name : Package binary (windows)
84+ if : runner.os == 'Windows'
85+ shell : bash
86+ run : |
87+ BIN=$(cabal -v0 list-bin elm-format)
88+ if [ ! -f "$BIN" ]; then
89+ BIN=$(find dist-newstyle -name elm-format.exe -type f | head -1)
90+ fi
91+ mkdir staging
92+ cp "$BIN" staging/elm-format.exe
93+ TAG=${GITHUB_REF_NAME}
94+ ZIPFILE="elm-format-${TAG}-${{ matrix.arch }}-${{ matrix.platform }}.zip"
95+ (cd staging && 7z a "../$ZIPFILE" elm-format.exe)
96+ echo "TARBALL=$ZIPFILE" >> $GITHUB_ENV
97+
8198 - name : Upload artifact
8299 uses : actions/upload-artifact@v4
83100 with :
84- name : elm-format-${{ matrix.arch }}-apple-darwin
101+ name : elm-format-${{ matrix.arch }}-${{ matrix.platform }}
85102 path : ${{ env.TARBALL }}
86103
87104 release :
@@ -100,34 +117,34 @@ jobs:
100117 merge-multiple : true
101118
102119 - name : List artifacts
103- run : ls -lh *.tar.gz
120+ run : ls -lh elm-format-*
104121
105122 - name : Create GitHub Release
106123 uses : softprops/action-gh-release@v2
107124 with :
108- files : ' *.tar.gz '
125+ files : ' elm-format-* '
109126 generate_release_notes : true
110127
111128 update-tap :
112129 needs : release
113130 runs-on : ubuntu-latest
114131 steps :
115- - name : Generate and display formula
132+ - name : Generate formula
116133 run : |
117134 TAG=${{ needs.release.outputs.tag }}
118135 VERSION=${TAG#v}
119136 REPO=${{ github.repository }}
120137
121- ARM64_URL ="https://github.com/${REPO}/releases/download/${TAG}/elm-format-${TAG}-arm64-apple-darwin.tar.gz"
122- X86_URL ="https://github.com/${REPO}/releases/download/${TAG}/elm-format-${TAG}-x86_64-apple-darwin .tar.gz"
138+ ARM64_MAC_URL ="https://github.com/${REPO}/releases/download/${TAG}/elm-format-${TAG}-arm64-apple-darwin.tar.gz"
139+ LINUX_URL ="https://github.com/${REPO}/releases/download/${TAG}/elm-format-${TAG}-x86_64-linux .tar.gz"
123140
124141 # Wait for release assets to be available
125142 sleep 10
126143
127- curl -sfL "$ARM64_URL " -o arm64.tar.gz
128- curl -sfL "$X86_URL " -o x86_64.tar.gz
129- ARM64_SHA =$(sha256sum arm64.tar.gz | cut -d' ' -f1)
130- X86_SHA =$(sha256sum x86_64.tar.gz | cut -d' ' -f1)
144+ curl -sfL "$ARM64_MAC_URL " -o arm64-mac .tar.gz
145+ curl -sfL "$LINUX_URL " -o x86_64-linux .tar.gz
146+ ARM64_MAC_SHA =$(sha256sum arm64-mac .tar.gz | cut -d' ' -f1)
147+ LINUX_SHA =$(sha256sum x86_64-linux .tar.gz | cut -d' ' -f1)
131148
132149 cat > elm-format.rb <<RUBY
133150 class ElmFormat < Formula
@@ -138,14 +155,16 @@ jobs:
138155
139156 on_macos do
140157 if Hardware::CPU.arm?
141- url "${ARM64_URL}"
142- sha256 "${ARM64_SHA}"
143- else
144- url "${X86_URL}"
145- sha256 "${X86_SHA}"
158+ url "${ARM64_MAC_URL}"
159+ sha256 "${ARM64_MAC_SHA}"
146160 end
147161 end
148162
163+ on_linux do
164+ url "${LINUX_URL}"
165+ sha256 "${LINUX_SHA}"
166+ end
167+
149168 def install
150169 bin.install "elm-format"
151170 end
@@ -156,12 +175,10 @@ jobs:
156175 end
157176 RUBY
158177
159- # Fix ruby indentation
160178 sed -i 's/^ //' elm-format.rb
161179
162180 echo "============================================"
163- echo "Copy this formula to your tap repo at:"
164- echo " Formula/elm-format.rb"
181+ echo "Generated formula:"
165182 echo "============================================"
166183 cat elm-format.rb
167184
0 commit comments