aboutsummaryrefslogtreecommitdiff
path: root/.circleci/config.yml
blob: b58f259e691e4fe846585fcc3cd67066c72ad508 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
version: "2.1"
jobs:
  build:
    macos:
      xcode: 11.1.0
    environment:
      HOMEBREW_NO_AUTO_UPDATE: 1
    steps:
    - checkout
    - restore_cache:
        # See https://circleci.com/docs/2.0/caching/
        name: Restore Cached Dependencies
        keys:
          - stack-dependencies-{{ checksum "stack.yaml" }}
    - run:
        name: Install stack
        command: stack --version || (curl -sSL https://get.haskellstack.org/ | sh -s - -f)
    - run:
        name: Resolve/Update Dependencies
        command: stack --no-terminal setup
    - run:
        name: Run tests
        command: stack --no-terminal test
    - run:
        name: Install executable
        command: stack --no-terminal install
    - run:
        name: Create artifacts
        command: |
          export VERSION=$(grep '^[Vv]ersion:' pandoc.cabal | awk '{print $$2;}')
          export ARTIFACTS=macos-release-candidate
          export RESOURCES=${ARTIFACTS}/Resources
          export ROOT=${ARTIFACTS}/pandoc
          export DEST=${ROOT}/usr/local
          export ME=$(whoami)
          export BASE=pandoc-$VERSION
          mkdir -p ${ARTIFACTS}
          mkdir -p ${RESOURCES}
          mkdir -p ${DEST}/bin
          mkdir -p ${DEST}/share/man/man1
          cp ~/.local/bin/pandoc ${DEST}/bin/
          strip ${DEST}/bin/pandoc
          cp man/pandoc.1 ${DEST}/share/man/man1/pandoc.1
          ~/.local/bin/pandoc -s COPYING.md -Vpagetitle=License -o ${RESOURCES}/license.html
          chown -R $ME:staff ${ROOT}
          sed -e "s/PANDOCVERSION/${VERSION}/" macos/distribution.xml.in > ${ARTIFACTS}/distribution.xml
          cp macos/Makefile ${ARTIFACTS}/
          echo ${VERSION} > ${ARTIFACTS}/version.txt
          zip -r macos-release-candidate.zip ${ARTIFACTS}

    - save_cache:
        name: Cache Dependencies
        key: stack-dependencies-{{ checksum "stack.yaml" }}
        paths:
        - "/root/.stack"
        - ".stack-work"
        - "/usr/local/bin/stack"

    - store_artifacts:
        # https://circleci.com/docs/2.0/artifacts/
        path: macos-release-candidate.zip
        destination: macos-release-candidate.zip

workflows:
  version: 2
  release:
    jobs:
    - build:
        filters:
          branches:
            only:
            - /rc\/.*/