-
Notifications
You must be signed in to change notification settings - Fork 0
110 lines (88 loc) · 2.99 KB
/
ci.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
name: CI
on:
push:
branches:
- main
paths-ignore:
- "**.md"
pull_request:
paths-ignore:
- "**.md"
release:
types: [published]
workflow_dispatch:
jobs:
hadolint:
uses: peaceiris/workflows/.github/workflows/[email protected]
pipenv:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: "3.10"
- uses: actions/cache@v3
with:
path: ~/.cache/pipenv
key: ${{ runner.os }}-pipenv-${{ hashFiles('**/Pipfile.lock') }}
restore-keys: |
${{ runner.os }}-pipenv-
- run: python3 -m pip install --upgrade pip pipenv
- run: pipenv sync --dev
- run: pipenv run mkdocs build --config-file ./mkdocs-sample.yml
netlify:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Upgrade pip
run: python3 -m pip install --upgrade pip
- name: Get pip cache dir
id: pip-cache
run: echo "PIP_CACHE_DIR=$(pip cache dir)" | tee -a "${GITHUB_OUTPUT}"
- uses: actions/cache@v3
with:
path: ${{ steps.pip-cache.outputs.PIP_CACHE_DIR }}
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
- name: Install dependencies
run: python3 -m pip install -r ./requirements.txt
- run: npx netlify-cli build
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
docker:
runs-on: ubuntu-22.04
env:
DOCKER_BASE_NAME: ghcr.io/peaceiris/mkdocs-material
steps:
- uses: actions/checkout@v4
- name: Set env
run: |
if [ "${{ github.event_name }}" = 'release' ]; then
export TAG_NAME="${{ github.event.release.tag_name }}"
else
export TAG_NAME="latest"
fi
echo "PKG_TAG=${DOCKER_BASE_NAME}:${TAG_NAME}" >> ${GITHUB_ENV}
- name: Build
run: |
docker build . -t "${PKG_TAG}"
- run: docker images
- name: Get mkdocs-material version
id: get-version
run: |
export MKDOCS_MATERIAL_VERSION=$(docker run --rm --entrypoint=bash "${PKG_TAG}" -c 'pip show mkdocs-material | grep -E ^Version')
echo "MKDOCS_MATERIAL_VERSION=${MKDOCS_MATERIAL_VERSION}" | tee -a "${GITHUB_OUTPUT}"
- run: echo "${{ steps.get-version.outputs.MKDOCS_MATERIAL_VERSION }}"
- name: mkdocs build
run: docker-compose run --rm mkdocs mkdocs build --config-file ./mkdocs-sample.yml
- name: Login to Registries
run: |
echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u peaceiris --password-stdin
- name: Push to GitHub Packages
if: ${{ github.event_name != 'pull_request' }}
run: docker push "${PKG_TAG}"