Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save cherryramatisdev/bc150104c9f14d191cc73b99b6853fe9 to your computer and use it in GitHub Desktop.
Save cherryramatisdev/bc150104c9f14d191cc73b99b6853fe9 to your computer and use it in GitHub Desktop.

how to build crystal for multiple OS

on:
  push:
  pull_request:
    branches: [main]
jobs:
  build:
    strategy:
      fail-fast: false
      matrix:
        os: [ubuntu-latest, macos-latest]
    runs-on: ${{ matrix.os }}
    steps:
      - name: Download source
        uses: actions/checkout@v2
      - name: Install Crystal
        uses: crystal-lang/install-crystal@v1
      - name: Build for linux
        if: ${{ matrix.os != 'macos-latest' }}
        run: shards build --production --release --static --no-debug -obin/${{ matrix.os }}
      - name: Build for macos
        if: ${{ matrix.os == 'macos-latest' }}
        run: shards build --production --release --no-debug -obin/${{ matrix.os }}
      - name: Upload artifact
        uses: actions/upload-artifact@v3
        with:
          name: artifact-${{matrix.os}}
          path: bin/${{matrix.os}}
#githubactions #pipeline #crystal
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment