Add support v12 alpha (#76) #40
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: CI | |
on: | |
push: | |
branches: [master] | |
# See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#filter-pattern-cheat-sheet | |
tags: | |
- "v[0-9]+.[0-9]+.[0-9]+" | |
- "v[0-9]+.[0-9]+.[0-9]+-*" | |
pull_request: | |
branches: [master] | |
concurrency: | |
group: ci-${{ github.ref }}-1 | |
# Cancel previous builds for pull requests only. | |
cancel-in-progress: ${{ github.event_name == 'pull_request' }} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
- name: NPM install | |
run: npm ci | |
- name: Build | |
run: npx rescript | |
- name: Pack | |
run: npm pack | |
- name: Prepare package upload | |
# For pull requests, pass the correct commit SHA explicitly as GITHUB_SHA points to the wrong commit. | |
run: node .github/workflows/prepare_package_upload.js ${{ github.event.pull_request.head.sha }} | |
- name: "Upload artifact: npm package" | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.artifact_filename }} | |
path: ${{ env.artifact_filename }} | |
outputs: | |
artifact_filename: ${{ env.artifact_filename }} | |
test: | |
needs: build | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ | |
macos-13, # x64 | |
macos-14, # ARM | |
ubuntu-latest, # x64 | |
buildjet-2vcpu-ubuntu-2204-arm, # ARM | |
windows-latest, | |
] | |
runs-on: ${{matrix.os}} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: ${{ needs.build.outputs.artifact_filename }} | |
- name: Test | |
env: | |
CI: 1 | |
shell: bash | |
run: | | |
npm i -g ${{ needs.build.outputs.artifact_filename }} | |
npx create-rescript-app | |
publish: | |
needs: [build, test] | |
if: startsWith(github.ref, 'refs/tags/v') | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
registry-url: https://registry.npmjs.org # Needed to make auth work for publishing | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: ${{ needs.build.outputs.artifact_filename }} | |
- name: Publish packages on npm with tag "ci" | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }} | |
run: | | |
npm publish ${{ needs.build.outputs.artifact_filename }} --tag ci |