Skip to content
This repository has been archived by the owner on Oct 12, 2024. It is now read-only.

chore(deps): update dependency phpstan/phpstan to v1.12.6 #1374

chore(deps): update dependency phpstan/phpstan to v1.12.6

chore(deps): update dependency phpstan/phpstan to v1.12.6 #1374

Workflow file for this run

---
name: "Build the blog"
on: # yamllint disable-line rule:truthy
# feature branches
pull_request:
# releases
push:
branches:
- main
# nightly build to automatically activate new blog posts. Slightly after midnight CET/CEST as it is UTC here.
schedule:
- cron: "22 2 * * *"
jobs:
build-the-blog:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.os }}-npm-${{ hashFiles('package.json') }}
restore-keys: |
${{ runner.os }}-npm-
- name: Build blog
run: |
cd src/
# remove the CDN dependency
LAYOUT_DIR=$(bundle show minimal-mistakes)
cp "$LAYOUT_DIR/_includes/head.html" "$LAYOUT_DIR/_includes/head.html.old"
sed '/fontawesome/d' "$LAYOUT_DIR/_includes/head.html.old" > "$LAYOUT_DIR/_includes/head.html"
JEKYLL_ENV=production bundle exec jekyll build
- uses: actions/setup-node@v4
with:
node-version: 19.x
- name: Install Fontawesome and comment system dependencies
run: |
npm install
mkdir -p target/assets/fontawesome/css
cp node_modules/@fortawesome/fontawesome-free/css/all.min.css target/assets/fontawesome/css/
cp -pr node_modules/@fortawesome/fontawesome-free/webfonts target/assets/fontawesome/
mkdir -p target/assets/js
cp node_modules/dayjs/plugin/relativeTime.js target/assets/js/
cp node_modules/dompurify/dist/purify.min.js target/assets/js/
cp node_modules/marked/marked.min.js target/assets/js/
cp node_modules/dayjs/dayjs.min.js target/assets/js/
- id: get-changed-files
if: github.event_name != 'schedule'
uses: jitterbit/get-changed-files@v1
with:
format: json
- name: Create Github issue for new posts
if: github.ref != 'refs/heads/main' && github.event_name != 'schedule'
run: |
echo "Changed files: ${{ steps.get-changed-files.outputs.added }}"
new_post=$(echo '${{ steps.get-changed-files.outputs.added }}' | jq -r .[] | grep src/_posts || true)
if [ -n "$new_post" ]; then
echo "New post found: $new_post"
title=$(sed -n -e 's/^.*title: //p' "$new_post" | tr -d '"')
issue_id=$(sed -n -e 's/^.*comments_id: //p' "$new_post" | grep -Eo '[0-9]+' || true)
echo "Title: $title"
echo "Issue ID: $issue_id"
if [ -z "$issue_id" ]; then
issue_response=$(curl -X "POST" "https://api.github.com/repos/kayman-mk/blog-tech-at-work/issues" \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "Content-Type: text/plain; charset=utf-8" \
-d "{
\"title\": \"$title\",
\"body\": \"The comments added to this issue are shown in the blog automatically.\",
\"labels\": [
\"blog-comment\",
\"not-published\"
]
}")
issue_id=$(echo "$issue_response" | jq -r .number)
echo "Created GitHub issue: $issue_id"
sed -i "2i comments_id: $issue_id" "$new_post"
fi
fi
- id: commit-changes
uses: stefanzweifel/git-auto-commit-action@v5
if: github.ref != 'refs/heads/main' && github.event_name != 'schedule'
with:
commit_message: "Add comments_id to new post"
file_pattern: src/_posts
- name: Activate GitHub issue for comments
if: github.ref == 'refs/heads/main' && github.event_name != 'schedule'
run: |
echo "Changed files: ${{ steps.get-changed-files.outputs.added }}"
new_post=$(echo '${{ steps.get-changed-files.outputs.added }}' | jq -r .[] | grep src/_posts || true)
if [ -n "$new_post" ]; then
echo "New post found: $new_post"
issue_id=$(sed -n -e 's/^.*comments_id: //p' "$new_post" | grep -Eo '[0-9]+')
curl -X "PATCH" "https://api.github.com/repos/kayman-mk/blog-tech-at-work/issues/$issue_id" \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "Content-Type: text/plain; charset=utf-8" \
-d "{
\"state\": \"closed\",
\"labels\": [
\"blog-comment\"
]
}"
fi
- name: Replace secrets
if: github.ref == 'refs/heads/main'
run: |
find . -type f -print0 | \
xargs -0 sed -i "s/__GH_API_TOKEN_COMMENT_SYSTEM__REPLACE_ME__/${{ secrets.GH_API_TOKEN_COMMENT_SYSTEM }}/g"
- name: Deploy
if: github.ref == 'refs/heads/main'
uses: SamKirkland/[email protected]
with:
server: af93d.netcup.net
username: ${{ secrets.FTP_USERNAME }}
password: ${{ secrets.FTP_PASSWORD }}
protocol: ftps
security: strict
local-dir: target/
server-dir: blog.matthiaskay.de/