Compare commits
23 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f62ab35fa8 | ||
|
|
a2a6cccd93 | ||
|
|
523c4fd9a6 | ||
|
|
fb68fce267 | ||
|
|
95c4253e26 | ||
|
|
8e246d07be | ||
|
|
76ea44a124 | ||
|
|
a3f7753a71 | ||
|
|
e23d61a4f0 | ||
|
|
155bba7b5a | ||
|
|
143ae9ba04 | ||
|
|
0512028c40 | ||
|
|
78e6af29ed | ||
|
|
fce00bad38 | ||
|
|
be5671616f | ||
|
|
e8bd522a52 | ||
|
|
30fdbe31f9 | ||
|
|
6c9d11f035 | ||
|
|
47c11b8fba | ||
|
|
de9d53f494 | ||
|
|
712881ad02 | ||
|
|
41cee6f459 | ||
|
|
e3e14d6ed0 |
@@ -2,40 +2,73 @@ version: 1
|
||||
kind: pipeline
|
||||
spec:
|
||||
stages:
|
||||
- name: build
|
||||
type: ci
|
||||
spec:
|
||||
steps:
|
||||
- name: debug
|
||||
type: run
|
||||
spec:
|
||||
name: debug
|
||||
container: alpine/git
|
||||
shell: sh
|
||||
script: |
|
||||
echo build.event = ${{ build.event }}
|
||||
echo build.target = ${{ build.target }}
|
||||
- name: lint
|
||||
type: run
|
||||
spec:
|
||||
name: lint
|
||||
container: jdkato/vale
|
||||
shell: sh
|
||||
script: |
|
||||
set -x
|
||||
set -e
|
||||
f=$(mktemp)
|
||||
cat open-resume.com.d/local-storage-about-srcdoc-open-resume.json | sed 's/"[^"]*":/"."/g' > $f
|
||||
vale sync
|
||||
vale $f || true
|
||||
- name: build
|
||||
type: run
|
||||
when: build.event == "push" && build.target == "main"
|
||||
spec:
|
||||
name: build
|
||||
container: andreysenov/firebase-tools
|
||||
envs:
|
||||
FIREBASE_CI_TOKEN: '${{ secrets.get("resume-firebase-squeaky2x3-gmail-token") }}'
|
||||
shell: sh
|
||||
script: |
|
||||
bash ./deploy.firebase.sh
|
||||
- name: build
|
||||
type: ci
|
||||
spec:
|
||||
volumes:
|
||||
- name: dockersock
|
||||
spec: {}
|
||||
type: temp
|
||||
steps:
|
||||
- name: debug
|
||||
type: run
|
||||
spec:
|
||||
name: debug
|
||||
container: alpine/git
|
||||
shell: sh
|
||||
script: |
|
||||
export build_event=${{ build.event }}
|
||||
export build_target=${{ build.target }}
|
||||
export build_before=${{ build.before }}
|
||||
export build_after=${{ build.after }}
|
||||
env | grep ^build_
|
||||
git --no-pager diff --name-only $build_before..$build_after
|
||||
- name: dind
|
||||
when: build.event == "push" && build.target == "main"
|
||||
type: background
|
||||
spec:
|
||||
container:
|
||||
image: registry-app.inhome.blapointe.com:5001/docker:latest
|
||||
privileged: true
|
||||
mount:
|
||||
- name: dockersock
|
||||
path: /var/run
|
||||
- name: docker
|
||||
type: run
|
||||
when: build.event == "push" && build.target == "main"
|
||||
spec:
|
||||
name: docker
|
||||
container: registry-app.inhome.blapointe.com:5001/docker:latest
|
||||
mount:
|
||||
- name: dockersock
|
||||
path: /var/run
|
||||
shell: sh
|
||||
script: |
|
||||
set -ueo pipefail
|
||||
|
||||
export build_before=${{ build.before }}
|
||||
export build_after=${{ build.after }}
|
||||
|
||||
apk add --no-cache git
|
||||
t=registry-app.inhome.blapointe.com:5001/portfolio/resume/builder:latest
|
||||
if git diff --name-only $build_before..$build_after | grep Dockerfile.cicd; then
|
||||
until docker ps; do
|
||||
sleep 5
|
||||
done
|
||||
docker build -t "$t" -f ./Dockerfile.cicd .
|
||||
docker push "$t"
|
||||
fi
|
||||
- name: build
|
||||
type: run
|
||||
when: build.event == "push" && build.target == "main"
|
||||
spec:
|
||||
name: build
|
||||
container:
|
||||
image: registry-app.inhome.blapointe.com:5001/portfolio/resume/builder:latest
|
||||
user: root
|
||||
envs:
|
||||
FIREBASE_CI_TOKEN: ${{ secrets.get("resume-firebase-squeaky2x3-gmail-token") }}
|
||||
GITLAB_PAT: ${{ secrets.get("resume-gitlab-gitlab-breel-dev-token") }}
|
||||
shell: sh
|
||||
script: |
|
||||
bash ./deploy.firebase.sh
|
||||
|
||||
11
Dockerfile.cicd
Normal file
11
Dockerfile.cicd
Normal file
@@ -0,0 +1,11 @@
|
||||
FROM jdkato/vale:latest as vale
|
||||
|
||||
FROM andreysenov/firebase-tools:latest
|
||||
|
||||
RUN echo installing dependencies...
|
||||
RUN apt -y install git woff2 bash
|
||||
|
||||
RUN echo copying vale...
|
||||
COPY --from=vale /bin/vale /bin/vale
|
||||
|
||||
RUN echo OK
|
||||
11
README.md
11
README.md
@@ -10,3 +10,14 @@
|
||||
1. `pbpaste > ./open-resume.com.d/resume.html`
|
||||
1. `cd ./open-resume.com.d/; bash ./clean_resume_html.sh; cd ..`
|
||||
1. `bash ./deploy.firebase.sh`
|
||||
|
||||
# Today
|
||||
|
||||
1. `gitness.inhome.blapointe.com` has a `./.harness` pipeline
|
||||
1. the pipeline
|
||||
1. renders [Resume](#resume) as `$(mktemp -d)/public`
|
||||
1. clones [gitlab](https://gitlab.com/breel/resume.git)
|
||||
1. replaces [gitlab](https://gitlab.com/breel/resume.git) with `.../public/`
|
||||
1. pushes [gitlab](https://gitlab.com/breel/resume.git)
|
||||
1. [render](https://dashboard.render.com/static/srv-cklkk8o710pc73d7fn7g) detects public repo event and updates its static site hosting for [breel.dev](https://breel.dev)
|
||||
1. [firebase](https://console.firebase.google.com/u/0/project/blapointe-com/overview) deploys `.../public/` for [blapointe.com](https://blapointe.com)
|
||||
|
||||
@@ -4,6 +4,13 @@ set -o pipefail
|
||||
set -e
|
||||
set -u
|
||||
|
||||
if which vale; then
|
||||
f=$(mktemp)
|
||||
cat open-resume.com.d/local-storage-about-srcdoc-open-resume.json | sed 's/"[^"]*":/"."/g' > $f
|
||||
vale sync
|
||||
vale $f || true
|
||||
fi
|
||||
|
||||
if tty && ! which firebase; then
|
||||
f="$(mktemp)"
|
||||
wget https://firebase.tools -O - > "$f"
|
||||
@@ -24,19 +31,61 @@ cp ./open-resume.com.d/resume.html.2 $outdir/public/index.html
|
||||
cp ./open-resume.com.d/resume.pdf $outdir/public/BreeLaPointeResume.pdf
|
||||
cp -r ./open-resume.com.d/fonts $outdir/public/
|
||||
|
||||
(
|
||||
if ! which woff2_compress; then
|
||||
sudo apt -y install woff2
|
||||
fi
|
||||
set -ueo pipefail
|
||||
for f in "$outdir"/public/fonts/*.ttf; do
|
||||
echo ttf to woff2 for "$f"
|
||||
if [ -f "$f" ]; then
|
||||
woff2_compress "$f"
|
||||
rm "$f"
|
||||
fi
|
||||
basename_f="${f##*/}"
|
||||
find "$outdir/public" -type f | grep -v public.fonts | while read -r f2; do
|
||||
sed -i "s#$basename_f#${basename_f%.ttf}.woff2#g" "$f2"
|
||||
done
|
||||
echo asserting no $basename_f
|
||||
! grep -R "$basename_f" "$outdir/public"
|
||||
echo asserting ${basename_f%.ttf}.woff2
|
||||
grep -R "${basename_f%.ttf}.woff2" "$outdir/public"
|
||||
done
|
||||
du -sh "$outdir/public/fonts/"*
|
||||
)
|
||||
|
||||
cp -r ./firebase.json ./.firebaserc ./.firebase $outdir/
|
||||
sed -i "s#deploy/public#public#" $outdir/firebase.json
|
||||
cd $outdir
|
||||
|
||||
echo firebase uses squeaky2x3@gmail.com
|
||||
! tty || firebase login
|
||||
echo firebase init
|
||||
args=()
|
||||
log_args=()
|
||||
if ! tty; then
|
||||
args+=("--token" "$FIREBASE_CI_TOKEN")
|
||||
log_args+=("--token" "${FIREBASE_CI_TOKEN:0:1}")
|
||||
test "${FIREBASE_CI_TOKEN:0:1}" != "$"
|
||||
fi
|
||||
echo firebase deploy "${log_args[@]}"
|
||||
firebase deploy "${args[@]}"
|
||||
(
|
||||
set -ueo pipefail
|
||||
if [ -n "$GITLAB_PAT" ]; then
|
||||
export HOME="$(mktemp -d)"
|
||||
git clone https://gitlab%40breel.dev:"$GITLAB_PAT"@gitlab.com/breel/resume.git gitlab-resume.d
|
||||
git config --global user.name "gitlab@breel.dev"
|
||||
git config --global user.email "gitlab@breel.dev"
|
||||
rm -rf ./gitlab-resume.d/*
|
||||
cp -r ./public/* ./gitlab-resume.d/
|
||||
cd ./gitlab-resume.d/
|
||||
git add -A :/
|
||||
git commit -m "$(date -u +%Y-%m-%dT%H:%M:%S)"
|
||||
git push origin main
|
||||
fi
|
||||
) || true
|
||||
|
||||
(
|
||||
set -ueo pipefail
|
||||
echo firebase uses squeaky2x3@gmail.com
|
||||
! tty || firebase login
|
||||
echo firebase init
|
||||
args=()
|
||||
log_args=()
|
||||
if ! tty; then
|
||||
args+=("--token" "$FIREBASE_CI_TOKEN")
|
||||
log_args+=("--token" "${FIREBASE_CI_TOKEN:0:1}")
|
||||
test "${FIREBASE_CI_TOKEN:0:1}" != "$"
|
||||
fi
|
||||
echo firebase deploy "${log_args[@]}"
|
||||
firebase deploy "${args[@]}"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user