|
| 1 | +on: |
| 2 | + push: |
| 3 | + tags: |
| 4 | + - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 |
| 5 | + |
| 6 | +name: Create Release |
| 7 | + |
| 8 | +jobs: |
| 9 | + build: |
| 10 | + name: Build Release |
| 11 | + runs-on: ${{ matrix.runner }} |
| 12 | + strategy: |
| 13 | + matrix: |
| 14 | + include: |
| 15 | + - os: Linux |
| 16 | + runner: ubuntu-latest |
| 17 | + artefact-name: "x86_64-linux" |
| 18 | + |
| 19 | + - os: MacOS |
| 20 | + runner: macos-latest |
| 21 | + artefact-name: "x86_64-macos" |
| 22 | + |
| 23 | + - os: Windows |
| 24 | + runner: windows-latest |
| 25 | + artefact-name: "x86_64-windows" |
| 26 | + |
| 27 | + steps: |
| 28 | + - name: Get tag name |
| 29 | + id: get_tag_name |
| 30 | + shell: bash |
| 31 | + run: echo ::set-output name=VERSION::${GITHUB_REF#refs/*/} |
| 32 | + |
| 33 | + - name: Checkout code |
| 34 | + uses: actions/checkout@v2 |
| 35 | + |
| 36 | + - if: matrix.os == 'MacOS' |
| 37 | + uses: actions/setup-haskell@v1 |
| 38 | + |
| 39 | + - if: matrix.os == 'Windows' |
| 40 | + name: Install Scoop |
| 41 | + run: | |
| 42 | + iwr -useb get.scoop.sh | iex |
| 43 | + echo "~\scoop\shims" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append |
| 44 | + echo "C:\ProgramData\scoop\shims" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append |
| 45 | +
|
| 46 | + - if: matrix.os == 'Windows' |
| 47 | + name: Install Stack |
| 48 | + run: scoop install stack |
| 49 | + |
| 50 | + - if: matrix.os == 'Windows' |
| 51 | + name: Install Zip |
| 52 | + run: scoop install zip --global |
| 53 | + |
| 54 | + - if: matrix.os == 'Windows' |
| 55 | + name: Install Clang |
| 56 | + run: scoop install llvm --global |
| 57 | + |
| 58 | + - if: matrix.os == 'Windows' |
| 59 | + uses: actions/cache@v1 |
| 60 | + name: Cache stack dependencies |
| 61 | + with: |
| 62 | + path: C:\\Users\\runneradmin\\AppData\\Local\\Programs\\stack |
| 63 | + key: ${{ runner.os }}-stack-deps-${{ github.sha }} |
| 64 | + restore-keys: ${{ runner.os }}-stack-deps |
| 65 | + |
| 66 | + - if: matrix.os == 'Windows' |
| 67 | + uses: actions/cache@v1 |
| 68 | + name: Cache stack build |
| 69 | + with: |
| 70 | + path: C:\\Users\\runneradmin\\AppData\\Roaming\\stack\ |
| 71 | + key: ${{ runner.os }}-stack-build-${{ github.sha }} |
| 72 | + restore-keys: ${{ runner.os }}-stack-build |
| 73 | + |
| 74 | + - name: Build and zip |
| 75 | + shell: bash |
| 76 | + run: "./scripts/release.sh carp-${{ steps.get_tag_name.outputs.VERSION }}-${{ matrix.artefact-name }} --noprompt" |
| 77 | + |
| 78 | + - name: Upload Artefact |
| 79 | + uses: actions/upload-artifact@v2 |
| 80 | + with: |
| 81 | + name: carp-${{ steps.get_tag_name.outputs.VERSION }}-${{ matrix.artefact-name }}.zip |
| 82 | + path: ./releases/carp-${{ steps.get_tag_name.outputs.VERSION }}-${{ matrix.artefact-name }}.zip |
| 83 | + if-no-files-found: error |
| 84 | + |
| 85 | + release: |
| 86 | + name: Upload Release |
| 87 | + needs: build |
| 88 | + runs-on: ubuntu-latest |
| 89 | + steps: |
| 90 | + - name: Get tag name |
| 91 | + id: get_tag_name |
| 92 | + shell: bash |
| 93 | + run: echo ::set-output name=VERSION::${GITHUB_REF#refs/*/} |
| 94 | + |
| 95 | + - name: Creates releases folder |
| 96 | + run: mkdir ./releases |
| 97 | + |
| 98 | + - name: Retrieve Windows artefact |
| 99 | + uses: actions/download-artifact@v2 |
| 100 | + with: |
| 101 | + name: carp-${{ steps.get_tag_name.outputs.VERSION }}-x86_64-windows.zip |
| 102 | + path: ./releases |
| 103 | + |
| 104 | + - name: Retrieve MacOS artefact |
| 105 | + uses: actions/download-artifact@v2 |
| 106 | + with: |
| 107 | + name: carp-${{ steps.get_tag_name.outputs.VERSION }}-x86_64-macos.zip |
| 108 | + path: ./releases |
| 109 | + |
| 110 | + - name: Retrieve Linux artefact |
| 111 | + uses: actions/download-artifact@v2 |
| 112 | + with: |
| 113 | + name: carp-${{ steps.get_tag_name.outputs.VERSION }}-x86_64-linux.zip |
| 114 | + path: ./releases |
| 115 | + |
| 116 | + - name: Release |
| 117 | + uses: ncipollo/release-action@v1 |
| 118 | + with: |
| 119 | + artifacts: "./releases/*.zip" |
| 120 | + body: | |
| 121 | + This is a release of the Carp compiler. |
| 122 | +
|
| 123 | + See [CHANGELOG.md](CHANGELOG.md) for a list of changes. |
| 124 | +
|
| 125 | + ## Installation |
| 126 | + - Download and unzip the corresponding zip file for your platform |
| 127 | + - Export an environment variable called `CARP_DIR` containing the path to the unzipped folder |
| 128 | + - Add `$CARP_DIR/bin` to your path |
| 129 | +
|
| 130 | + You should now be able to run the REPL by calling `carp` |
| 131 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 132 | + tag: ${{ steps.get_tag_name.outputs.VERSION }} |
| 133 | + allowUpdates: true |
| 134 | + removeArtifacts: true |
| 135 | + replacesArtifacts: true |
| 136 | + artifactContentType: "application/zip" |
0 commit comments