Regenerate #71
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 Test | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
type: [ synchronize ] | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
if: "!contains(github.event.head_commit.message, 'ci skip')" | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup Dhall | |
uses: dhall-lang/setup-dhall@v4 | |
- uses: cachix/install-nix-action@v12 | |
with: | |
nix_path: nixpkgs=channel:nixos-21.05 | |
- name: Dhall test | |
run: | | |
dhall-to-json <<< "./examples/dynamo.dhall" | |
- name: build | |
run: nix-build | |
docs: | |
runs-on: ubuntu-latest | |
if: "github.ref == 'refs/heads/master'" | |
needs: | |
- test | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup Dhall | |
uses: dhall-lang/setup-dhall@v4 | |
- name: Checkout Docs | |
uses: actions/checkout@v2 | |
with: | |
ref: gh-pages | |
path: gh-pages | |
- name: build | |
run: | | |
curl -L https://github.com/dhall-lang/dhall-haskell/releases/download/1.40.1/dhall-docs-1.0.7-x86_64-linux.tar.bz2 | tar --extract --bzip2 | |
VERSION=$(dhall text < ./version.dhall) | |
./bin/dhall-docs --input ./ --base-import-url https://raw.githubusercontent.com/jcouyang/dhall-aws-cloudformation/${VERSION} | |
cp -r docs/* gh-pages/ | |
cd gh-pages | |
git config user.name github-actions | |
git config user.email github-actions@github.com | |
git add . | |
git commit -m "generated doc" | |
git push | |
publish: | |
runs-on: ubuntu-latest | |
if: "!contains(github.event.head_commit.message, 'publish skip') && (github.ref == 'refs/heads/master')" | |
needs: | |
- test | |
permissions: | |
packages: write | |
contents: write | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup Dhall | |
uses: dhall-lang/setup-dhall@v4 | |
- uses: cachix/install-nix-action@v12 | |
with: | |
nix_path: nixpkgs=channel:nixos-21.05 | |
- name: Log in to the Container registry | |
uses: docker/login-action@v1.10.0 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: publish docker image | |
run: | | |
$(nix-build docker.nix) | docker load | |
LOCAL_VERSION=$(dhall text < ./version.dhall) | |
docker tag ghcr.io/jcouyang/dhall-aws-cloudformation:latest ghcr.io/jcouyang/dhall-aws-cloudformation:$LOCAL_VERSION | |
docker push ghcr.io/jcouyang/dhall-aws-cloudformation:latest | |
docker push ghcr.io/jcouyang/dhall-aws-cloudformation:$LOCAL_VERSION | |
- name: package cache | |
run: | | |
nix-build package.nix | |
tar -czhf cache.tar.gz ./result | |
- name: tag release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
LAST_RELEASE=$(hub release -L 1) | |
LOCAL_VERSION=$(dhall text < ./version.dhall) | |
echo "main version is $LAST_RELEASE and current version is $LOCAL_VERSION" | |
if [ ${LAST_RELEASE:-0} != $LOCAL_VERSION ];then | |
hub release create -m "${LOCAL_VERSION}" -a ./cache.tar.gz "${LOCAL_VERSION}" | |
fi | |
- name: publish doc | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
bin/gen-readme.sh | |
git add README.md | |
git config user.name github-actions | |
git config user.email github-actions@github.com | |
git commit --allow-empty -m "update readme [ci skip]" | |
git push |