|
| 1 | +name: Create Release |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - 'v*' |
| 7 | + |
| 8 | +jobs: |
| 9 | + draft_release: |
| 10 | + name: Draft Release |
| 11 | + runs-on: ubuntu-latest |
| 12 | + outputs: |
| 13 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 14 | + |
| 15 | + steps: |
| 16 | + - name: Create Release |
| 17 | + id: create_release |
| 18 | + uses: actions/create-release@v1 |
| 19 | + env: |
| 20 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 21 | + with: |
| 22 | + tag_name: ${{ github.ref }} |
| 23 | + release_name: Release ${{ github.ref }} |
| 24 | + body: | |
| 25 | + Changes in this Release |
| 26 | + - First Change |
| 27 | + - Second Change |
| 28 | + draft: true |
| 29 | + prerelease: false |
| 30 | + |
| 31 | + release-mac: |
| 32 | + name: Create Release |
| 33 | + needs: draft_release |
| 34 | + runs-on: ${{ matrix.os }} |
| 35 | + env: |
| 36 | + MACOSX_DEPLOYMENT_TARGET: 10.13 |
| 37 | + strategy: |
| 38 | + matrix: |
| 39 | + os: |
| 40 | + - macOS-10.15 |
| 41 | + steps: |
| 42 | + - name: Checkout code |
| 43 | + uses: actions/checkout@v2 |
| 44 | + |
| 45 | + - uses: haskell/actions/[email protected] |
| 46 | + with: |
| 47 | + ghc-version: 8.10.4 |
| 48 | + cabal-version: 3.4.0.0 |
| 49 | + |
| 50 | + - name: create ~/.local/bin |
| 51 | + run: mkdir -p "$HOME/.local/bin" |
| 52 | + shell: bash |
| 53 | + |
| 54 | + - name: Add ~/.local/bin to PATH |
| 55 | + run: echo "$HOME/.local/bin" >> $GITHUB_PATH |
| 56 | + shell: bash |
| 57 | + |
| 58 | + - name: Update cabal cache |
| 59 | + run: cabal update |
| 60 | + shell: bash |
| 61 | + |
| 62 | + - name: Install cabal dependencies |
| 63 | + run: cabal build --only-dependencies --constraint="zlib +bundled-c-zlib" --constraint="lzma +static" -ftui |
| 64 | + shell: bash |
| 65 | + |
| 66 | + - name: Build |
| 67 | + run: cabal build --constraint="zlib +bundled-c-zlib" --constraint="lzma +static" -ftui |
| 68 | + shell: bash |
| 69 | + |
| 70 | + - name: Install |
| 71 | + run: cp "$(cabal list-bin exe:ghcup)" ~/.local/bin/ghcup |
| 72 | + shell: bash |
| 73 | + |
| 74 | + - name: Strip |
| 75 | + run: strip ~/.local/bin/ghcup |
| 76 | + shell: bash |
| 77 | + |
| 78 | + - name: Run tests |
| 79 | + run: cabal test --constraint="zlib +bundled-c-zlib" --constraint="lzma +static" all |
| 80 | + shell: bash |
| 81 | + |
| 82 | + - name: Install git |
| 83 | + run: brew install git |
| 84 | + |
| 85 | + - name: set HOME |
| 86 | + run: echo "HOME=$HOME" >> $GITHUB_ENV |
| 87 | + shell: bash |
| 88 | + |
| 89 | + - name: Set ASSET_PATH |
| 90 | + run: echo "ASSET_PATH=$HOME/.local/bin/ghcup" >> $GITHUB_ENV |
| 91 | + shell: bash |
| 92 | + |
| 93 | + - name: Upload Release Asset |
| 94 | + id: upload-release-asset |
| 95 | + uses: actions/upload-release-asset@v1 |
| 96 | + env: |
| 97 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 98 | + with: |
| 99 | + upload_url: ${{ needs.draft_release.outputs.upload_url }} |
| 100 | + asset_path: ${{ env.ASSET_PATH }} |
| 101 | + asset_name: ghcup-${{ matrix.os }} |
| 102 | + asset_content_type: application/octet-stream |
| 103 | + |
| 104 | + - if: always() |
| 105 | + uses: actions/upload-artifact@v2 |
| 106 | + with: |
| 107 | + name: plan.json |
| 108 | + path: ./dist-newstyle/cache/plan.json |
| 109 | + |
0 commit comments