-
Notifications
You must be signed in to change notification settings - Fork 12
80 lines (68 loc) · 2.36 KB
/
build.yml
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
73
74
75
76
77
78
79
80
name: Build
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
env:
DOCKER_BUILDKIT: "1"
# This will be empty on events that aren't pull requests.
ACTUAL_GITHUB_SHA_ON_PULL_REQUEST: "${{ github.event.pull_request.head.sha }}"
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive
fetch-depth: 3
- name: Login to Packages Container registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push the mate-dev image
run: ./ci/gha-docker-build "dev" "mate-dev"
- name: Build the MATE bdist
run: |
# Extremely annoying: the `pull_request` event creates a merge commit,
# which means that `GITHUB_SHA` is completely useless to key off of.
# We have to do some additional sleuthing for these events to get the right
# commit.
if [[ "${GITHUB_EVENT_NAME}" == "pull_request" ]]; then
ref="${ACTUAL_GITHUB_SHA_ON_PULL_REQUEST}"
else
ref="${GITHUB_SHA}"
fi
docker run \
--rm -v $(pwd):/mate \
"ghcr.io/galoisinc/mate-dev:${ref}" \
./shake.sh -j bdist
- name: Build and push the mate-dist image
run: |
# HACK: These files are owned by the container root, so we can't
# read them until we change their permissions.
sudo chmod a+r -R .out/
./ci/gha-docker-build "dist" "mate-dist"
./ci/gha-docker-build "notebook" "mate-notebook"
./ci/gha-docker-build "ui" "mate-ui"
- name: Build the docs
run: |
# See above comment
if [[ "${GITHUB_EVENT_NAME}" == "pull_request" ]]; then
ref="${ACTUAL_GITHUB_SHA_ON_PULL_REQUEST}"
else
ref="${GITHUB_SHA}"
fi
docker run \
--rm -v $(pwd):/mate \
"ghcr.io/galoisinc/mate-dev:${ref}" \
./shake.sh -j doc
- name: Upload docs to Github Pages
uses: peaceiris/actions-gh-pages@v3
if: ${{ github.ref == 'refs/heads/main' }}
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: .out/bdist/local/doc/html