|
| 1 | +# This is a basic workflow to help you get started with Actions |
| 2 | + |
| 3 | +name: CI |
| 4 | + |
| 5 | +# Controls when the workflow will run |
| 6 | +on: |
| 7 | + # Triggers the workflow on push or pull request events but only for the hakyll branch |
| 8 | + push: |
| 9 | + branches: [ hakyll ] |
| 10 | + pull_request: |
| 11 | + branches: [ hakyll ] |
| 12 | + |
| 13 | + # Allows you to run this workflow manually from the Actions tab |
| 14 | + workflow_dispatch: |
| 15 | + |
| 16 | +# A workflow run is made up of one or more jobs that can run sequentially or in parallel |
| 17 | +jobs: |
| 18 | + # This workflow contains a single job called "build" |
| 19 | + build: |
| 20 | + # The type of runner that the job will run on |
| 21 | + runs-on: ubuntu-latest |
| 22 | + |
| 23 | + strategy: |
| 24 | + matrix: |
| 25 | + stack: ["2.7.3"] |
| 26 | + ghc: ["8.10.7"] |
| 27 | + |
| 28 | + # Steps represent a sequence of tasks that will be executed as part of the job |
| 29 | + steps: |
| 30 | + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it |
| 31 | + - uses: actions/checkout@v2 |
| 32 | + with: |
| 33 | + fetch-depth: 0 |
| 34 | + ref: hakyll |
| 35 | + |
| 36 | + - uses: haskell/actions/setup@v1 |
| 37 | + name: Setup Haskell Stack |
| 38 | + with: |
| 39 | + ghc-version: ${{ matrix.ghc }} |
| 40 | + stack-version: ${{ matrix.stack }} |
| 41 | + |
| 42 | + - uses: actions/cache@v1 |
| 43 | + name: Cache ~/.stack |
| 44 | + with: |
| 45 | + path: ~/.stack |
| 46 | + key: ${{ runner.os }}-${{ matrix.ghc }}-stack |
| 47 | + |
| 48 | + - name: Build dependencies |
| 49 | + run: stack build --system-ghc --only-dependencies |
| 50 | + |
| 51 | + - name: Build site executable |
| 52 | + run: stack build --system-ghc |
| 53 | + |
| 54 | + # Runs a set of commands using the runners shell |
| 55 | + - name: Deploy |
| 56 | + run: | |
| 57 | + git config user.name github-actions |
| 58 | + git config user.email [email protected] |
| 59 | + stack exec --system-ghc site rebuild |
| 60 | + git checkout testrelease |
| 61 | + git pull --rebase |
| 62 | + # Overwrite existing files with new files |
| 63 | + cp -a -v _site/. . |
| 64 | + # Commit |
| 65 | + git add --all |
| 66 | + git commit -m "[`date '+%F %T %Z'`] New release [ci skip]" |
| 67 | + # Push |
| 68 | + git push origin testrelease:testrelease |
0 commit comments