From cf3fddfe3a8f696dbdf178980265c8c990775724 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20D=C3=A9v=C3=A9?= Date: Fri, 17 Sep 2021 12:49:06 +0100 Subject: [PATCH] ci: Merges different platform releases into one (#1313) * ci: Merges different platform releases into one * ci: Removes platform specific release pipelines --- .github/disabled-workflows/release_macos.yml | 41 ------ .github/workflows/release.yml | 136 +++++++++++++++++++ .github/workflows/release_linux.yml | 45 ------ .github/workflows/release_macos.yml | 47 ------- .github/workflows/release_windows.yml | 76 ----------- 5 files changed, 136 insertions(+), 209 deletions(-) delete mode 100644 .github/disabled-workflows/release_macos.yml create mode 100644 .github/workflows/release.yml delete mode 100644 .github/workflows/release_linux.yml delete mode 100644 .github/workflows/release_macos.yml delete mode 100644 .github/workflows/release_windows.yml diff --git a/.github/disabled-workflows/release_macos.yml b/.github/disabled-workflows/release_macos.yml deleted file mode 100644 index f771930a..00000000 --- a/.github/disabled-workflows/release_macos.yml +++ /dev/null @@ -1,41 +0,0 @@ -on: - push: - tags: - - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 - -name: Create Release (macOS) - -jobs: - build: - name: Create Release - runs-on: macos-latest - steps: - - name: Checkout code - uses: actions/checkout@v2 - - - name: Build and zip - run: ./scripts/release.sh ${{ github.ref }} --noprompt - - - name: Create Github Release - id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ github.ref }} - release_name: Release ${{ github.ref }} - body: | - This is a release of the Carp compiler on macOS. - draft: false - prerelease: false - - - name: Upload Release Asset - id: upload-release-asset - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./releases/${{ github.ref }}.zip - asset_name: ${{ github.ref }}.zip - asset_content_type: application/zip diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 00000000..4bd734b3 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,136 @@ +on: + push: + tags: + - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 + +name: Create Release + +jobs: + build: + name: Build Release + runs-on: ${{ matrix.runner }} + strategy: + matrix: + include: + - os: Linux + runner: ubuntu-latest + artefact-name: "x86_64-linux" + + - os: MacOS + runner: macos-latest + artefact-name: "x86_64-macos" + + - os: Windows + runner: windows-latest + artefact-name: "x86_64-windows" + + steps: + - name: Get tag name + id: get_tag_name + shell: bash + run: echo ::set-output name=VERSION::${GITHUB_REF#refs/*/} + + - name: Checkout code + uses: actions/checkout@v2 + + - if: matrix.os == 'MacOS' + uses: actions/setup-haskell@v1 + + - if: matrix.os == 'Windows' + name: Install Scoop + run: | + iwr -useb get.scoop.sh | iex + echo "~\scoop\shims" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + echo "C:\ProgramData\scoop\shims" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + + - if: matrix.os == 'Windows' + name: Install Stack + run: scoop install stack + + - if: matrix.os == 'Windows' + name: Install Zip + run: scoop install zip --global + + - if: matrix.os == 'Windows' + name: Install Clang + run: scoop install llvm --global + + - if: matrix.os == 'Windows' + uses: actions/cache@v1 + name: Cache stack dependencies + with: + path: C:\\Users\\runneradmin\\AppData\\Local\\Programs\\stack + key: ${{ runner.os }}-stack-deps-${{ github.sha }} + restore-keys: ${{ runner.os }}-stack-deps + + - if: matrix.os == 'Windows' + uses: actions/cache@v1 + name: Cache stack build + with: + path: C:\\Users\\runneradmin\\AppData\\Roaming\\stack\ + key: ${{ runner.os }}-stack-build-${{ github.sha }} + restore-keys: ${{ runner.os }}-stack-build + + - name: Build and zip + shell: bash + run: "./scripts/release.sh carp-${{ steps.get_tag_name.outputs.VERSION }}-${{ matrix.artefact-name }} --noprompt" + + - name: Upload Artefact + uses: actions/upload-artifact@v2 + with: + name: carp-${{ steps.get_tag_name.outputs.VERSION }}-${{ matrix.artefact-name }}.zip + path: ./releases/carp-${{ steps.get_tag_name.outputs.VERSION }}-${{ matrix.artefact-name }}.zip + if-no-files-found: error + + release: + name: Upload Release + needs: build + runs-on: ubuntu-latest + steps: + - name: Get tag name + id: get_tag_name + shell: bash + run: echo ::set-output name=VERSION::${GITHUB_REF#refs/*/} + + - name: Creates releases folder + run: mkdir ./releases + + - name: Retrieve Windows artefact + uses: actions/download-artifact@v2 + with: + name: carp-${{ steps.get_tag_name.outputs.VERSION }}-x86_64-windows.zip + path: ./releases + + - name: Retrieve MacOS artefact + uses: actions/download-artifact@v2 + with: + name: carp-${{ steps.get_tag_name.outputs.VERSION }}-x86_64-macos.zip + path: ./releases + + - name: Retrieve Linux artefact + uses: actions/download-artifact@v2 + with: + name: carp-${{ steps.get_tag_name.outputs.VERSION }}-x86_64-linux.zip + path: ./releases + + - name: Release + uses: ncipollo/release-action@v1 + with: + artifacts: "./releases/*.zip" + body: | + This is a release of the Carp compiler. + + See [CHANGELOG.md](CHANGELOG.md) for a list of changes. + + ## Installation + - Download and unzip the corresponding zip file for your platform + - Export an environment variable called `CARP_DIR` containing the path to the unzipped folder + - Add `$CARP_DIR/bin` to your path + + You should now be able to run the REPL by calling `carp` + token: ${{ secrets.GITHUB_TOKEN }} + tag: ${{ steps.get_tag_name.outputs.VERSION }} + allowUpdates: true + removeArtifacts: true + replacesArtifacts: true + artifactContentType: "application/zip" diff --git a/.github/workflows/release_linux.yml b/.github/workflows/release_linux.yml deleted file mode 100644 index fbeaa7bf..00000000 --- a/.github/workflows/release_linux.yml +++ /dev/null @@ -1,45 +0,0 @@ -on: - push: - tags: - - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 - -name: Create Release (Linux) - -jobs: - build: - name: Create Release - runs-on: ubuntu-latest - steps: - - name: Get tag name - id: get_tag_name - run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} - - - name: Checkout code - uses: actions/checkout@v2 - - - name: Build and zip - run: "./scripts/release.sh ${{ steps.get_tag_name.outputs.VERSION }} --noprompt" - - - name: Create Github Release - id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ steps.get_tag_name.outputs.VERSION }}_Linux - release_name: Release ${{ steps.get_tag_name.outputs.VERSION }}_Linux - body: | - This is a release of the Carp compiler on Linux. - draft: false - prerelease: false - - - name: Upload Release Asset - id: upload-release-asset - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./releases/${{ steps.get_tag_name.outputs.VERSION }}.zip - asset_name: ${{ steps.get_tag_name.outputs.VERSION }}.zip - asset_content_type: application/zip diff --git a/.github/workflows/release_macos.yml b/.github/workflows/release_macos.yml deleted file mode 100644 index 3ea5097f..00000000 --- a/.github/workflows/release_macos.yml +++ /dev/null @@ -1,47 +0,0 @@ -on: - push: - tags: - - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 - -name: Create Release (macOS) - -jobs: - build: - name: Create Release - runs-on: macos-latest - steps: - - name: Get tag name - id: get_tag_name - run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} - - - name: Checkout code - uses: actions/checkout@v2 - - - uses: actions/setup-haskell@v1 - - - name: Build and zip - run: ./scripts/release.sh ${{ steps.get_tag_name.outputs.VERSION }} --noprompt - - - name: Create Github Release - id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ steps.get_tag_name.outputs.VERSION }}_macOS - release_name: Release ${{ steps.get_tag_name.outputs.VERSION }}_macOS - body: | - This is a release of the Carp compiler on macOS. - draft: false - prerelease: false - - - name: Upload Release Asset - id: upload-release-asset - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./releases/${{ steps.get_tag_name.outputs.VERSION }}.zip - asset_name: ${{ steps.get_tag_name.outputs.VERSION }}.zip - asset_content_type: application/zip diff --git a/.github/workflows/release_windows.yml b/.github/workflows/release_windows.yml deleted file mode 100644 index 50f38163..00000000 --- a/.github/workflows/release_windows.yml +++ /dev/null @@ -1,76 +0,0 @@ -on: - push: - tags: - - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 - -name: Create Release (Windows) - -jobs: - build: - name: Create Release - runs-on: windows-latest - steps: - - name: Get tag name - id: get_tag_name - shell: bash - run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//} - - - name: Check out - uses: actions/checkout@v2 - - - name: Install Scoop - run: | - iwr -useb get.scoop.sh | iex - echo "~\scoop\shims" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append - echo "C:\ProgramData\scoop\shims" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append - - - name: Install Stack - run: scoop install stack - - - name: Install Zip - run: scoop install zip --global - - - uses: actions/cache@v1 - name: Cache stack dependencies - with: - path: C:\\Users\\runneradmin\\AppData\\Local\\Programs\\stack - key: ${{ runner.os }}-stack-deps-${{ github.sha }} - restore-keys: ${{ runner.os }}-stack-deps - - - uses: actions/cache@v1 - name: Cache stack build - with: - path: C:\\Users\\runneradmin\\AppData\\Roaming\\stack\ - key: ${{ runner.os }}-stack-build-${{ github.sha }} - restore-keys: ${{ runner.os }}-stack-build - - - name: Install Clang - run: scoop install llvm --global - - - name: Build and zip - shell: bash - run: "./scripts/release.sh ${{ steps.get_tag_name.outputs.VERSION }} --noprompt" - - - name: Create Github Release - id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ steps.get_tag_name.outputs.VERSION }}_Windows - release_name: Release ${{ steps.get_tag_name.outputs.VERSION }}_Windows - body: | - This is a release of the Carp compiler on Windows. - draft: false - prerelease: false - - - name: Upload Release Asset - id: upload-release-asset - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - asset_path: ./releases/${{ steps.get_tag_name.outputs.VERSION }}.zip - asset_name: ${{ steps.get_tag_name.outputs.VERSION }}.zip - asset_content_type: application/zip