|
| 1 | + |
| 2 | +name: "Setup stylish-haskell" |
| 3 | +description: "Install a specific stylish-haskell version" |
| 4 | +inputs: |
| 5 | + stylish-haskell-version: |
| 6 | + required: true |
| 7 | + description: "Version of stylish-haskell" |
| 8 | + ghc-version: |
| 9 | + required: true |
| 10 | + description: "Version of GHC" |
| 11 | + cabal-version: |
| 12 | + required: true |
| 13 | + description: "Version of cabal" |
| 14 | + hackage-index-state: |
| 15 | + required: false |
| 16 | + description: "Timestamp for Hackage index" |
| 17 | + default: "" |
| 18 | +runs: |
| 19 | + using: composite |
| 20 | + steps: |
| 21 | + - name: 💾 Restore cache |
| 22 | + uses: actions/cache/restore@v4 |
| 23 | + if: ${{ !env.ACT }} |
| 24 | + id: cache-stylish-haskell |
| 25 | + with: |
| 26 | + path: "${{ github.workspace }}/.stylish-haskell/bin" |
| 27 | + key: ${{ runner.os }}-stylish-haskell-${{ inputs.stylish-haskell-version }}-input-state-${{ inputs.hackage-index-state }} |
| 28 | + |
| 29 | + - name: 🛠️ Install Haskell |
| 30 | + if: ${{ env.ACT || steps.cache-stylish-haskell.outputs.cache-hit != 'true' }} |
| 31 | + uses: haskell-actions/setup@v2 |
| 32 | + id: setup-haskell |
| 33 | + with: |
| 34 | + ghc-version: ${{ inputs.ghc-version }} |
| 35 | + cabal-version: ${{ inputs.cabal-version }} |
| 36 | + |
| 37 | + - name: 🛠️ Install stylish-haskell |
| 38 | + if: ${{ env.ACT || steps.cache-stylish-haskell.outputs.cache-hit != 'true' }} |
| 39 | + run: | |
| 40 | + mkdir --parents "${{ github.workspace }}/.stylish-haskell/bin" |
| 41 | + cabal install stylish-haskell-${{ inputs.stylish-haskell-version }} \ |
| 42 | + ${{ inputs.hackage-index-state && format('--index-state={0}', inputs.hackage-index-state) }} \ |
| 43 | + --overwrite-policy=always \ |
| 44 | + --install-method=copy \ |
| 45 | + --installdir="${{ github.workspace }}/.stylish-haskell/bin" |
| 46 | + shell: sh |
| 47 | + |
| 48 | + - name: 🛠️ Add stylish-haskell to PATH |
| 49 | + run: echo "${{ github.workspace }}/.stylish-haskell/bin" >> "$GITHUB_PATH" |
| 50 | + shell: sh |
| 51 | + |
| 52 | + - name: 💾 Save cache |
| 53 | + uses: actions/cache/save@v4 |
| 54 | + if: ${{ !env.ACT && steps.cache-stylish-haskell.outputs.cache-hit != 'true' }} |
| 55 | + with: |
| 56 | + path: "${{ github.workspace }}/.stylish-haskell/bin" |
| 57 | + key: ${{ steps.cache-stylish-haskell.outputs.cache-primary-key }} |
0 commit comments