Skip to content

Commit 8e6c901

Browse files
authored
Bugfix/upload cv (#28)
This pull request introduces significant updates to the GitHub Actions workflows for deployment and release automation, along with minor documentation and content changes. The most notable changes include restructuring the deployment pipeline, adding a new workflow for automated releases, and updating relevant documentation to reflect these changes. ### Workflow Restructuring and Automation: * [`.github/workflows/deploy.yml`](diffhunk://#diff-28802fbf11c83a2eee09623fb192785e7ca92a3f40602a517c011b947a1822d3L1-L26): Refactored the deployment workflow to separate concerns into distinct jobs (`build-web`, `build-cv`, `deploy-web`, and `deploy-cv`). Added conditional triggers for `push` events on `main` and `release` events to streamline deployment processes. Introduced a new `Upload Pages Artifact` and `Upload CV Artifact` step for better artifact management. [[1]](diffhunk://#diff-28802fbf11c83a2eee09623fb192785e7ca92a3f40602a517c011b947a1822d3L1-L26) [[2]](diffhunk://#diff-28802fbf11c83a2eee09623fb192785e7ca92a3f40602a517c011b947a1822d3R36-R60) [[3]](diffhunk://#diff-28802fbf11c83a2eee09623fb192785e7ca92a3f40602a517c011b947a1822d3L69-R100) [[4]](diffhunk://#diff-28802fbf11c83a2eee09623fb192785e7ca92a3f40602a517c011b947a1822d3L89-R112) * [`.github/workflows/release.yml`](diffhunk://#diff-87db21a973eed4fef5f32b267aa60fcee5cbdf03c67fafdc2a9b553bb0b15f34R1-R49): Added a new workflow to automatically create a GitHub release when a version bump is detected in `package.json`. This includes validating that only `package.json` was modified, extracting the version, and creating a release tag. ### Documentation Updates: * [`README.md`](diffhunk://#diff-b335630551682c19a781afebcf4d07bf978fb1f8ac04c6bf87428ed5106870f5L1-R8): Updated the README to explain the new deployment workflow, including the steps required to trigger the deploy pipeline by creating a version bump pull request. ### Content Removal: * [`src/assets/md/about.md`](diffhunk://#diff-115e3491a2ebce52fe6e5f73d5b2617d3e3f40699c7a03a426879cf24ea0fc89L1-L12): Removed the "About Me" section content, potentially for a redesign or replacement.
1 parent fe22f59 commit 8e6c901

File tree

5 files changed

+104
-73
lines changed

5 files changed

+104
-73
lines changed

.github/workflows/deploy.yml

Lines changed: 45 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,27 @@
1-
name: Deploy to GitHub Pages
1+
name: Build and Deploy
22

33
on:
4-
# Allows you to run this workflow manually from the Actions tab on GitHub.
4+
push:
5+
branches:
6+
- main
7+
release:
8+
types: [created]
59
workflow_dispatch:
610

7-
# Allow this job to clone the repo and create a page deployment
811
permissions:
912
contents: write
1013
pages: write
1114
id-token: write
1215

1316
jobs:
14-
prepare:
17+
build-web:
18+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/heads/main') || github.event_name == 'workflow_dispatch'
1519
runs-on: ubuntu-latest
1620
outputs:
17-
pnpm-cache-key: ${{ steps.export-cache-key.outputs.key }}
1821
neovim-lines: ${{ steps.lines.outputs.count }}
1922
steps:
2023
- uses: actions/checkout@v4
2124

22-
# just a workaround to not duplicate the same steps
23-
- uses: ./.github/actions/build-with-cv
24-
with:
25-
cv: ${{ secrets.CV }}
26-
2725
- name: Checkout NeoVim config
2826
uses: actions/checkout@v4
2927
with:
@@ -35,14 +33,31 @@ jobs:
3533
run: |
3634
COUNT=$(find . -path './.git*' -prune -o -type f -exec wc -l {} \; | awk '{sum+=$1} END {print sum}')
3735
echo "count=$COUNT" >> "$GITHUB_OUTPUT"
36+
echo "NEOVIM_CONFIG_LINES=$COUNT" >> "$GITHUB_ENV"
3837
working-directory: './neovim_config'
3938

39+
- name: Set CV_LOCATION environment variable
40+
run: |
41+
TAG_NAME=${GITHUB_REF_NAME#refs/tags/}
42+
PDF_URL="https://github.com/${GITHUB_REPOSITORY}/releases/download/${TAG_NAME}/cv.pdf"
43+
echo "CV_LOCATION=$PDF_URL" >> $GITHUB_ENV
44+
45+
- uses: ./.github/actions/build-with-cv
46+
with:
47+
cv: ${{ secrets.CV }}
48+
49+
- name: Upload Pages Artifact
50+
uses: actions/upload-pages-artifact@v3
51+
with:
52+
path: ./dist/
53+
4054
build-cv:
41-
needs: prepare
55+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/heads/main') || github.event_name == 'workflow_dispatch'
56+
needs: build-web
4257
runs-on: ubuntu-latest
4358
env:
4459
GITHUB_RUN_NUMBER: ${{ github.run_number }}
45-
NEOVIM_CONFIG_LINES: ${{ needs.prepare.outputs.neovim-lines }}
60+
NEOVIM_CONFIG_LINES: ${{ needs.build-web.outputs.neovim-lines }}
4661
steps:
4762
- uses: actions/checkout@v4
4863

@@ -66,16 +81,23 @@ jobs:
6681
run: |
6782
pnpm run export-pdf
6883
69-
- name: Create GitHub Release (if not exists)
70-
id: create_release
71-
uses: softprops/action-gh-release@v2
84+
- name: Upload CV Artifact
85+
uses: actions/upload-artifact@v4
7286
with:
73-
tag_name: ${{ github.ref_name }}
74-
name: Release ${{ github.ref_name }}
75-
draft: false
76-
prerelease: false
77-
env:
78-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
87+
path: ./cv.pdf
88+
89+
deploy-cv:
90+
if: github.event_name == 'release' && github.event.action == 'created' || github.event_name == 'workflow_dispatch'
91+
needs: build-cv
92+
runs-on: ubuntu-latest
93+
env:
94+
GITHUB_RUN_NUMBER: ${{ github.run_number }}
95+
NEOVIM_CONFIG_LINES: ${{ needs.build-web.outputs.neovim-lines }}
96+
steps:
97+
- name: Download CV Artifact
98+
uses: actions/download-artifact@v4
99+
with:
100+
path: ./cv.pdf
79101

80102
- name: Upload PDF as Release Asset
81103
uses: softprops/action-gh-release@v2
@@ -86,38 +108,8 @@ jobs:
86108
env:
87109
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
88110

89-
build-web:
90-
needs: prepare
91-
runs-on: ubuntu-latest
92-
env:
93-
GITHUB_RUN_NUMBER: ${{ github.run_number }}
94-
NEOVIM_CONFIG_LINES: ${{ needs.prepare.outputs.neovim-lines }}
95-
steps:
96-
- uses: actions/checkout@v4
97-
98-
- uses: actions/cache@v4
99-
with:
100-
path: ~/.local/share/pnpm/store/v3
101-
key: ${{ runner.os }}-pnpm-${{ hashFiles('**/pnpm-lock.yaml') }}
102-
restore-keys: ${{ runner.os }}-pnpm-
103-
104-
- name: Set CV_LOCATION environment variable
105-
run: |
106-
TAG_NAME=${GITHUB_REF_NAME#refs/tags/}
107-
PDF_URL="https://github.com/${GITHUB_REPOSITORY}/releases/download/${TAG_NAME}/cv.pdf"
108-
echo "CV_LOCATION=$PDF_URL" >> $GITHUB_ENV
109-
110-
- uses: ./.github/actions/build-with-cv
111-
with:
112-
cv: ${{ secrets.CV }}
113-
114-
115-
- name: Upload Pages Artifact
116-
uses: actions/upload-pages-artifact@v3
117-
with:
118-
path: ./dist/
119-
120-
deploy:
111+
deploy-web:
112+
if: github.event_name == 'release' && github.event.action == 'created' || github.event_name == 'workflow_dispatch'
121113
needs: build-web
122114
runs-on: ubuntu-latest
123115
environment:

.github/workflows/release.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Auto Release on Version Bump
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
create-release:
13+
runs-on: ubuntu-latest
14+
if: contains(github.event.head_commit.message, 'Bump website version')
15+
steps:
16+
- name: Checkout repo
17+
uses: actions/checkout@v4
18+
19+
- name: Get modified files in last commit
20+
id: files
21+
run: |
22+
echo "files=$(git diff-tree --no-commit-id --name-only -r ${{ github.sha }})" >> $GITHUB_OUTPUT
23+
24+
- name: Check if only package.json was modified
25+
id: check_files
26+
run: |
27+
files="${{ steps.files.outputs.files }}"
28+
# Only package.json allowed
29+
if [ "$files" != "package.json" ]; then
30+
echo "Only package.json modification allowed, exiting."
31+
exit 1
32+
fi
33+
echo "Only package.json modified."
34+
35+
- name: Read version from package.json
36+
id: get_version
37+
run: |
38+
version=$(jq -r '.version' package.json)
39+
echo "version=$version" >> $GITHUB_OUTPUT
40+
41+
- name: Create release tag and GitHub Release
42+
uses: softprops/action-gh-release@v2
43+
with:
44+
tag_name: "v${{ steps.get_version.outputs.version }}"
45+
name: "Release v${{ steps.get_version.outputs.version }}"
46+
draft: false
47+
prerelease: false
48+
env:
49+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

README.md

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
#TODO
2-
- [ ] Implement contact me page
3-
- [ ] Remove tailwindcss-animate
4-
- [ ] Use oklch instead of hsl
5-
- [ ] Solve TODOs in codebase
6-
- [ ] Interpret • as special character and render strings containing it as `li`
7-
- [ ] Put my big ass face in this website
1+
# How does deployment work?
2+
Every time there is push on `main` it will trigger the build pipeline and cache
3+
the artifacts.
4+
5+
To actually do the deploy of the website and CV in release artifacts the following must be carried out:
6+
7+
1. Create a PR which only bumps the version named "Bump website version"
8+
2. By merging the PR it will trigger the deploy pipeline

src/assets/md/about.md

Lines changed: 0 additions & 12 deletions
This file was deleted.

tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
"name": "@astrojs/ts-plugin"
1313
}
1414
],
15-
"types": ["vitest/globals"]
15+
"types": ["vitest/globals"],
16+
"resolveJsonModule": true
1617
},
1718
"exclude": ["dist"],
1819
"extends": "astro/tsconfigs/strictest",

0 commit comments

Comments
 (0)