Build and publish on commit 'try' / 34f7b1554d963dfc4bc761801fdc2fc398ec1131 #67
This file contains 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: build-and-publish-on-commit | |
run-name: "Build and publish on commit '${{ github.event.head_commit.message }}' / ${{ github.sha }}" | |
on: | |
push: | |
branches: | |
- hakyll | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
# these versions are aligned with the versions used by the lts | |
ghc: ['9.0.2'] | |
cabal: ['3.4.1.0'] | |
os: [ubuntu-latest] | |
resolver: [lts-19.32] | |
name: ${{ matrix.resolver }} (${{ matrix.ghc }}/${{ matrix.cabal }}) | |
steps: | |
- uses: actions/checkout@v3 | |
name: Checkout and submodules | |
with: | |
submodules: recursive | |
token: ${{ github.token }} | |
- uses: actions/cache@v3 | |
name: Cache ~/.stack | |
with: | |
path: ~/.stack | |
key: ${{ runner.os }}-stack-global-${{ hashFiles('stack.yaml') }}-${{ hashFiles('package.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-stack-global- | |
- uses: actions/cache@v3 | |
name: Cache .stack-work | |
with: | |
path: .stack-work | |
key: ${{ runner.os }}-stack-work-${{ hashFiles('stack.yaml') }}-${{ hashFiles('package.yaml') }}-${{ hashFiles('**/*.hs') }} | |
restore-keys: | | |
${{ runner.os }}-stack-work- | |
- name: Setup Haskell | |
uses: haskell/actions/setup@v1 | |
with: | |
ghc-version: ${{ matrix.ghc }} | |
cabal-version: ${{ matrix.cabal }} | |
enable-stack: true | |
- name: update module | |
run: | | |
git submodule sync | |
git submodule update --remote | |
- name: build | |
run: | | |
stack --resolver ${{ matrix.resolver }} build --no-run-tests --no-run-benchmarks | |
- name: run tests | |
run: | | |
stack --resolver ${{ matrix.resolver }} test | |
- name: hakyll build | |
run: | | |
stack --no-terminal exec site build | |
- name: publish | |
run: | | |
cd _site | |
git remote set-url --push origin https://miguel-vila:[email protected]/miguel-vila/miguel-vila.github.io.git | |
git config --global user.email 41898282+github-actions[bot]@users.noreply.github.com | |
git config --global user.name github-actions[bot] | |
git add --all | |
git diff-index --quiet HEAD || git commit -m "Update (`date '+%F %T %Z'`) - ${{ github.event.head_commit.message }} - [ci skip]" | |
git push origin HEAD:master | |
env: | |
GITHUB_TOKEN: ${{ github.token }} |