Release Build #13
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: Upload Build | |
uses: actions/upload-artifact@v2 | |
with: | |
name: ${{ matrix.os }} | |
path: ppx_src/_build/default/bin/bin.exe | |
retention-days: 1 | |
npm-release: | |
name: NPM Release | |
runs-on: ubuntu-latest | |
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/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 |