-
Notifications
You must be signed in to change notification settings - Fork 27
91 lines (78 loc) · 2.42 KB
/
ppx-push.yaml
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
82
83
84
85
86
87
88
89
90
91
name: Release Build
on:
release:
types: published
workflow_dispatch: # This line makes the workflow runnable on demand
jobs:
cancel-previous-runs:
name: Cancel Previous Runs
runs-on: ubuntu-20.04
steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
build:
name: PPX Build Matrix
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.ref }}
- name: Install OPAM and OCaml and build
uses: ocaml/setup-ocaml@v2
with:
ocaml-compiler: 4.12.1
- name: Install opam packages
run: opam install . --deps-only
working-directory: ppx_src
- name: Build the ppx
run: opam exec -- dune build
working-directory: ppx_src
- name: Print out the tree of the build directory on windows
run: ls -R
working-directory: ppx_src/_build
- name: Upload Build Mac / Linux
if: ${{ matrix.os != 'windows-latest' }}
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.os }}
path: ppx_src/_build/default/bin/bin.exe
retention-days: 1
- name: Upload Build Windows
if: ${{ matrix.os == 'windows-latest' }}
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.os }}
path: ppx_src/_esy/default/store/b/*/default/bin/bin.exe
retention-days: 1
npm-release:
name: NPM Release
runs-on: ubuntu-latest
if: github.event.action == 'published'
needs:
- build
steps:
- name: Checkout
uses: actions/checkout@v2
with:
ref: ${{ github.ref }}
- name: Download Artifacts
uses: actions/download-artifact@v2
- name: Move / Rename Artifacts
run: |
mv ubuntu-latest/bin.exe ./ppx-linux.exe
mv macos-latest/bin.exe ./ppx-osx.exe
mv windows-latest/*/default/bin/bin.exe ./ppx-windows.exe
- uses: actions/setup-node@v1
with:
always-auth: true
registry-url: "https://registry.npmjs.org"
- env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
run: |
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
yarn publish