-
Notifications
You must be signed in to change notification settings - Fork 45
124 lines (122 loc) · 4.37 KB
/
prod.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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
name: Production deployment
on:
push:
branches:
- main
- master
jobs:
docker:
if: "!contains(github.event.commits[0].message, '[skip ci]')"
runs-on: ubuntu-latest
steps:
-
name: Set up QEMU
if: ${{ github.repository == 'linogaliana/python-datascientist' }}
uses: docker/setup-qemu-action@v1
-
name: Set up Docker Buildx
if: ${{ github.repository == 'linogaliana/python-datascientist' }}
uses: docker/setup-buildx-action@v1
-
name: Login to DockerHub
if: ${{ github.repository == 'linogaliana/python-datascientist' }}
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build and push
if: ${{ github.repository == 'linogaliana/python-datascientist' }}
id: docker_build
uses: docker/build-push-action@v2
env:
GITHUB_PAT: ${{ secrets.PAT }}
with:
file: "docker/Dockerfile"
push: true
tags: linogaliana/python-datascientist:master
-
name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
pages:
name: Render-Blog
runs-on: ubuntu-latest
container: linogaliana/python-datascientist:latest
needs: docker
if: ${{ !github.event.pull_request.head.repo.fork }}
steps:
- uses: actions/checkout@v2
with:
#fetch-depth: 0
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{github.event.pull_request.head.repo.full_name}}
- name: Configure safe.directory # Workaround for actions/checkout#760
run: git config --global --add safe.directory /__w/python-datascientist/python-datascientist
- name: Render website
run: |
python build/append_environment.py
quarto render --to html
- name: Publish to Pages
if: github.ref == 'refs/heads/master'
run: |
git config --global user.email quarto-github-actions-publish@example.com
git config --global user.name "Quarto GHA Workflow Runner"
quarto publish gh-pages . --no-render --no-browser
enonces:
name: Render notebooks
runs-on: ubuntu-latest
container: linogaliana/python-datascientist:latest
needs: docker
if: ${{ !github.event.pull_request.head.repo.fork }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.ref }}
- name: Configure safe.directory # Workaround for actions/checkout#760
run: |
git config --global --add safe.directory /__w/python-datascientist/python-datascientist
git config --global --add safe.directory /__w/python-datascientist/python-datascientist-notebooks
- shell: bash
run: |
ls
conda info
conda list
- name: Convert in ipynb with Quarto
run: |
find content -type f -name "*.qmd" >> diff
cat diff
python build/tweak_render.py
python build/pimp_notebook.py
quarto render content --to ipynb
mkdir -p temp_notebooks
mkdir -p temp_notebooks/notebooks
python build/move_files.py temp_notebooks/notebooks
quarto render content --to ipynb --execute -M echo:true
mkdir -p temp_notebooks/corrections
python build/move_files.py temp_notebooks/corrections
- uses: actions/upload-artifact@v2
with:
name: Source enonce
path: content/
- uses: actions/upload-artifact@v2
with:
name: Enonces
path: temp_notebooks/notebooks/
- uses: actions/upload-artifact@v2
with:
name: Enonces
path: temp_notebooks/corrections/
- name: Pushes to another repository
uses: linogaliana/github-action-push-to-another-repository@main
env:
API_TOKEN_GITHUB: ${{ secrets.API_TOKEN_GITHUB }}
with:
source-directory: 'temp_notebooks/'
destination-repository-username: 'linogaliana'
destination-repository-name: 'python-datascientist-notebooks'
user-email: lino.galiana@insee.fr
destination-github-username: linogaliana
#target-branch: test
create-target-branch-if-needed: true
reset-repo: true