Skip to content

feat: post no. 7 getting started with fluxcd #110

feat: post no. 7 getting started with fluxcd

feat: post no. 7 getting started with fluxcd #110

Workflow file for this run

name: ci
concurrency:
cancel-in-progress: ${{ ! startsWith(github.ref, 'refs/tags/v') }}
group: ci-${{ github.ref_name }}-${{ github.event_name }}
on:
pull_request:
branches:
- main
push:
branches:
- main
permissions:
contents: write
env:
NETLIFY_SITE_ID: 6c071198-df44-4eee-8819-3b6a980a332b
NETLIFY_DEPLOY_TO_PROD: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
PYTHON_VERSION: 3.x
jobs:
build:
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Calculate cache id
run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
- name: Cache mkdocs-material
uses: actions/cache@v4
with:
key: mkdocs-material-${{ env.cache_id }}
path: .cache
restore-keys: |
mkdocs-material-
- env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
name: Install dependencies
run: |
pip install -U pip -r requirements.txt
sudo apt-get install -y libcairo2-dev libfreetype6-dev libffi-dev libjpeg-dev libpng-dev libz-dev pngquant
- env:
GA_PROPERTY: ${{ vars.GA_PROPERTY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DRAFT: ${{ github.event_name == 'pull_request' }}
name: Build the site
run: mkdocs build
- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v3
with:
name: build-pr${{ github.event.pull_request.number }}
path: site
- name: Deploy to Netlify
uses: jsmrcaga/action-netlify-deploy@v2.1.0
with:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_DEPLOY_TO_PROD: ${{ env.NETLIFY_DEPLOY_TO_PROD }}
NETLIFY_SITE_ID: ${{ env.NETLIFY_SITE_ID }}
build_command: echo Skipping building the web files
build_directory: site
install_command: echo Skipping installing the dependencies
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
permissions:
id-token: write
pages: write
pull-requests: write
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Configure Git Credentials
run: |
git config user.name ${{ github.actor }}
git config user.email ${{ github.actor }}@users.noreply.github.com
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Calculate cache id
run: echo "cache_id=$(date --utc '+%V')" >> $GITHUB_ENV
- name: Cache mkdocs-material
uses: actions/cache@v4
with:
key: mkdocs-material-${{ env.cache_id }}
path: .cache
restore-keys: |
mkdocs-material-
- env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
name: Install dependencies
run: |
pip install -U pip -r requirements.txt
sudo apt-get install -y libcairo2-dev libfreetype6-dev libffi-dev libjpeg-dev libpng-dev libz-dev pngquant
- env:
GA_PROPERTY: ${{ vars.GA_PROPERTY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
name: Build the site
run: mkdocs build
- name: Upload Pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: site
- id: deployment
name: Deploy to GitHub Pages
uses: actions/deploy-pages@v4
- id: netlify
name: Deploy to Netlify
uses: jsmrcaga/action-netlify-deploy@v2.1.0
with:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_DEPLOY_TO_PROD: ${{ env.NETLIFY_DEPLOY_TO_PROD }}
NETLIFY_SITE_ID: ${{ env.NETLIFY_SITE_ID }}
build_command: echo Skipping building the web files
build_directory: site
install_command: echo Skipping installing the dependencies
- name: Publish preview URL
uses: meysam81/comment-pr@main
with:
title: "# Preview URL"
content: |
Please visit this link to preview the changes:
${{ steps.netlify.outputs.NETLIFY_PREVIEW_URL }}
token: ${{ secrets.GITHUB_TOKEN }}
lychee:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- id: lychee
name: Link Checker
uses: lycheeverse/lychee-action@v1
with:
fail: ${{ github.ref == 'refs/heads/main' }}
- if: env.lychee_exit_code != 0
name: Create Issue From File
uses: peter-evans/create-issue-from-file@v5
with:
content-filepath: ./lychee/out.md
labels: report, automated issue
trivy:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
scan-type:
- fs
- config
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Trivy ${{ matrix.scan-type }}
uses: aquasecurity/trivy-action@master
with:
exit-code: "1"
scan-ref: .
scan-type: ${{ matrix.scan-type }}
trivy-config: trivy.yaml