-
Notifications
You must be signed in to change notification settings - Fork 182
81 lines (69 loc) · 2.46 KB
/
build-mingw64.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
name: Build mingw64 binary
on:
release:
types: [released]
workflow_dispatch:
inputs:
ref:
required: true
default: 'main'
jobs:
build:
runs-on: windows-latest
steps:
- name: Set ref for release builds
if: github.event_name == 'release'
run: |
"build_ref=${{ github.ref }}" >> $env:GITHUB_ENV
- name: Set ref for manual builds
if: github.event_name == 'workflow_dispatch'
run: |
"build_ref=${{ github.event.inputs.ref }}" >> $env:GITHUB_ENV
- name: Set artifact name
shell: bash
run: |
echo "artifact_name=ocamlformat-${build_ref##*/}.exe" >> $GITHUB_ENV
- name: Disable Git EOL Conversion
run: |
git config --global core.autocrlf false
- name: Checkout Repository
uses: actions/checkout@v3
with:
ref: ${{ env.build_ref }}
- uses: ocaml/setup-ocaml@v2
with:
ocaml-compiler: 4.14.x
opam-repositories: |
default: https://github.com/ocaml-opam/opam-repository-mingw.git#sunset
opam: https://github.com/ocaml/opam-repository.git
- name: Install dependencies
run: |
opam pin add -yn ocamlformat-lib.dev .
opam pin add -yn ocamlformat.dev .
opam install -y --deps-only ocamlformat
- name: Build
run: |
opam exec -- dune subst
opam exec -- dune build -p ocamlformat-lib,ocamlformat @install
opam exec -- dune install --prefix=install ocamlformat
Copy-Item ${{ github.workspace }}\\install\\bin\\ocamlformat.exe -Destination .\${{ env.artifact_name }}
- name: Version check
run: |
echo "Version check:"
install/bin/ocamlformat.exe --version
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: ${{ env.artifact_name }}
path: ${{ env.artifact_name }}
if-no-files-found: error
- name: Upload Release Asset
if: github.event_name == 'release'
run: >
curl.exe
--data-binary '@${{ env.artifact_name }}'
-X POST
-H "Content-Type: application/octet-stream"
-H "Accept: application/vnd.github+json"
-H "Authorization: Bearer ${{ github.token }}"
"https://uploads.github.com/repos/${{ github.repository }}/releases/${{ github.event.release.id }}/assets?name=${{ env.artifact_name }}"