From 852448283000c941a40dce0e044e8d8d1891cb14 Mon Sep 17 00:00:00 2001 From: fwcd Date: Wed, 12 Apr 2023 15:09:41 +0200 Subject: [PATCH] Add deployment workflow --- .github/workflows/deploy.yml | 61 ++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 .github/workflows/deploy.yml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..b2ec788 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,61 @@ +name: Deploy + +on: + push: + tags: + - '*' + workflow_dispatch: + +jobs: + release: + runs-on: ubuntu-latest + steps: + - name: Get tag name + id: tag + run: | + tag=$(basename "${{ github.ref }}") + echo "tag=$tag" >> $GITHUB_OUTPUT + - name: Create release + env: + GH_TOKEN: ${{ github.token }} + GH_REPO: ${{ github.repository }} + run: | + tag="${{ steps.tag.outputs.tag }}" + echo "Tag: $tag" + gh release create "$tag" --title "$tag" + + build: + strategy: + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + + needs: [release] + runs-on: ${{ matrix.os }} + steps: + - name: Get platform + id: platform + shell: bash + run: | + os=$(echo "${{ runner.os }}" | tr '[:upper:]' '[:lower:]') + arch=$(echo "${{ runner.arch }}" | tr '[:upper:]' '[:lower:]') + platform="$arch-$os" + echo "Platform: $platform" + echo "platform=$platform" >> $GITHUB_OUTPUT + - uses: actions/checkout@v3 + - name: Set up Haskell and Stack + uses: haskell/actions/setup@v2 + with: + enable-stack: true + stack-version: 'latest' + - name: Build + run: stack install --local-bin-path bin + - name: Archive and upload + env: + GH_TOKEN: ${{ github.token }} + GH_REPO: ${{ github.repository }} + shell: bash + run: | + tag="${{ steps.platform.outputs.platform }}" + archivename="curry-language-server-$platform.zip" + zip -r "$archivename" bin + gh release upload "${{ needs.release.outputs.tag }}" "$archivename"