-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathazure-pipelines.yml
More file actions
91 lines (75 loc) · 2.61 KB
/
azure-pipelines.yml
File metadata and controls
91 lines (75 loc) · 2.61 KB
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
trigger:
- master
pool:
vmImage: 'ubuntu-latest'
variables:
gh_user_source_code: hugolmn
gh_repo_source_code: garanse
gh_user_build: garanse
gh_repo_build: garanse.github.io
gh_pass: $(gh_pat)
gh_email: $(email)
steps:
- checkout: none
persistCredentials: false
# Importation of git repositories
- script: git clone "https://$(gh_pat)@github.com/$(gh_user_source_code)/$(gh_repo_source_code).git" source_code
workingDirectory: $(Build.StagingDirectory)
displayName: "[Git] Clone Github pages source code repository"
- script: git clone "https://$(gh_pat)@github.com/$(gh_user_build)/$(gh_repo_build).git" build
workingDirectory: $(Build.StagingDirectory)
displayName: "[Git] Clone Github pages built website repository"
- task: UsePythonVersion@0
inputs:
versionSpec: '3.11'
- script: python -m pip install --upgrade pillow
displayName: 'Install tools'
- script: python generate-images.py
workingDirectory: $(Build.StagingDirectory)/source_code/assets/images/
displayName: 'Resizing new images'
# Setting up Ruby & Jekyll
- task: UseRubyVersion@0
inputs:
versionSpec: '3.3'
displayName: '[Ruby] Use Ruby == 3.3'
- script: gem install bundler
workingDirectory: $(Build.StagingDirectory)
displayName: "[Jekyll] Install Bundler"
- script: |
cd source_code
bundle update jekyll
bundle install
workingDirectory: $(Build.StagingDirectory)
displayName: "[Jekyll] Install dependencies"
# Building the website
- script: |
cd source_code
bundle exec jekyll build
workingDirectory: $(Build.StagingDirectory)
displayName: "[Jekyll] Build website"
- script: |
cd build
rm -rf *
workingDirectory: $(Build.StagingDirectory)
displayName: "[Git] Removing previous build"
- script: mv source_code/_site/* build/
workingDirectory: $(Build.StagingDirectory)
displayName: "[Git] Moving new build to build folder"
- script: |
cd source_code
git config user.email $(gh_email)
git config user.name $(gh_user_source_code)
git add .
git commit -m "Azure pipeline updated source code"
git push "https://$(gh_user_source_code):$(gh_pass)@github.com/$(gh_user_source_code)/$(gh_repo_source_code).git" master
workingDirectory: $(Build.StagingDirectory)
displayName: '[Git] Push source_code'
- script: |
cd build
git config user.email $(gh_email)
git config user.name $(gh_user_source_code)
git add .
git commit -m "Azure pipeline automatic build"
git push "https://$(gh_user_source_code):$(gh_pass)@github.com/$(gh_user_build)/$(gh_repo_build).git" master
workingDirectory: $(Build.StagingDirectory)
displayName: '[Git] Push new build'