Formatting #230
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Deploy on release | |
| on: | |
| push: | |
| tags: | |
| - "[0-9]*" | |
| - "test*" | |
| branches: | |
| - "ci-test" | |
| jobs: | |
| build: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: | |
| - ubuntu-22.04 | |
| - ubuntu-22.04-arm | |
| - macos-latest | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - run: echo "GITHUB_TAG=$(git describe --always --tags)" >> $GITHUB_ENV | |
| - if: ${{ startsWith(matrix.os, 'ubuntu') && !endsWith(matrix.os, 'arm') }} | |
| run: echo "OS_SHORT_NAME=linux" >> $GITHUB_ENV | |
| - if: ${{ startsWith(matrix.os, 'ubuntu') && endsWith(matrix.os, 'arm') }} | |
| run: echo "OS_SHORT_NAME=linux-arm" >> $GITHUB_ENV | |
| - if: ${{ startsWith(matrix.os, 'macos') }} | |
| run: echo "OS_SHORT_NAME=macos" >> $GITHUB_ENV | |
| - if: ${{ startsWith(matrix.os, 'windows') }} | |
| run: echo "OS_SHORT_NAME=windows" >> $GITHUB_ENV | |
| - name: Set up OCaml for Linux | |
| uses: ocaml/setup-ocaml@v3 | |
| with: | |
| ocaml-compiler: "5.2.1" | |
| - run: opam install dune | |
| - run: opam install . --deps-only --with-test | |
| - name: Use commit hash as version if on ci-test branch | |
| if: ${{ github.ref_name == 'ci-test' }} | |
| run: | | |
| echo "DOCFD_VERSION_OVERRIDE=${{ env.GITHUB_TAG }}" >> $GITHUB_ENV | |
| - name: Create build for macOS | |
| if: ${{ env.OS_SHORT_NAME == 'macos' }} | |
| run: | | |
| export DOCFD_VERSION_OVERRIDE=${{ env.GITHUB_TAG }} | |
| opam exec -- make release-build | |
| - name: Create static build for Linux | |
| if: ${{ env.OS_SHORT_NAME == 'linux' }} | |
| run: | | |
| export DOCFD_VERSION_OVERRIDE=${{ env.GITHUB_TAG }} | |
| opam exec -- make release-static-build | |
| - name: Create static build for Linux ARM | |
| if: ${{ env.OS_SHORT_NAME == 'linux-arm' }} | |
| run: | | |
| export DOCFD_VERSION_OVERRIDE=${{ env.GITHUB_TAG }} | |
| opam exec -- make release-static-build-arm | |
| - name: Package into tar.gz | |
| run: | | |
| mv release/docfd docfd | |
| tar -cvzf docfd-${{ env.GITHUB_TAG }}-${{ env.OS_SHORT_NAME }}.tar.gz docfd | |
| - name: Upload artifacts | |
| if: ${{ github.ref_name == 'ci-test' }} | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: docfd-${{ env.GITHUB_TAG }}-${{ env.OS_SHORT_NAME }}.tar.gz | |
| path: docfd-${{ env.GITHUB_TAG }}-${{ env.OS_SHORT_NAME }}.tar.gz | |
| - name: Release | |
| if: ${{ github.ref_name != 'ci-test' }} | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| files: | | |
| docfd-${{ env.GITHUB_TAG }}-${{ env.OS_SHORT_NAME }}.tar.gz |