Changed conditions of running GitHub actions (#2082)
The GitHub actions were running everytime a new commit was made to the repo, but that wasn't needed. For example, we don't need to try to create a new docker image if the libraries didn't change, same to build the whole site after a change in the README.md. --------- Signed-off-by: George Araújo <george.gcac@gmail.com>
This commit is contained in:
parent
1d4a8c742b
commit
04f7b041a1
|
|
@ -28,14 +28,14 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout 🛎️
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
- name: Setup Ruby
|
||||
uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
ruby-version: "3.2.2"
|
||||
ruby-version: "3.3"
|
||||
bundler-cache: true
|
||||
- name: Update _config.yml ⚙️
|
||||
uses: fjogeleit/yaml-update-action@v0.13.1
|
||||
uses: fjogeleit/yaml-update-action@main
|
||||
with:
|
||||
commitChange: false
|
||||
valueFile: "_config.yml"
|
||||
|
|
@ -48,9 +48,11 @@ jobs:
|
|||
run: |
|
||||
pip3 install --upgrade jupyter
|
||||
npm install -g mermaid.cli
|
||||
npm install -g purgecss
|
||||
export JEKYLL_ENV=production
|
||||
bundle exec jekyll build --lsi
|
||||
- name: Purge unused CSS 🧹
|
||||
run: |
|
||||
npm install -g purgecss
|
||||
purgecss -c purgecss.config.js
|
||||
- name: Run axe 🪓
|
||||
# https://github.com/dequelabs/axe-core-npm/tree/develop/packages/cli
|
||||
|
|
|
|||
|
|
@ -1,33 +1,29 @@
|
|||
name: Check for broken links on site
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- main
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
- main
|
||||
workflow_dispatch:
|
||||
workflow_run:
|
||||
workflows: [Deploy site]
|
||||
types: [completed]
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
check-links-on-site:
|
||||
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#running-a-workflow-based-on-the-conclusion-of-another-workflow
|
||||
if: ${{ github.event.workflow_run.conclusion == 'success' }}
|
||||
# available images: https://github.com/actions/runner-images#available-images
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout 🛎️
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
- name: Setup Ruby
|
||||
uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
ruby-version: "3.2.2"
|
||||
ruby-version: "3.3"
|
||||
bundler-cache: true
|
||||
- name: Update _config.yml ⚙️
|
||||
uses: fjogeleit/yaml-update-action@v0.13.1
|
||||
uses: fjogeleit/yaml-update-action@main
|
||||
with:
|
||||
commitChange: false
|
||||
valueFile: "_config.yml"
|
||||
|
|
@ -40,9 +36,11 @@ jobs:
|
|||
run: |
|
||||
pip3 install --upgrade jupyter
|
||||
npm install -g mermaid.cli
|
||||
npm install -g purgecss
|
||||
export JEKYLL_ENV=production
|
||||
bundle exec jekyll build --lsi
|
||||
- name: Purge unused CSS 🧹
|
||||
run: |
|
||||
npm install -g purgecss
|
||||
purgecss -c purgecss.config.js
|
||||
- name: Link Checker 🔗
|
||||
uses: lycheeverse/lychee-action@v1.9.0
|
||||
|
|
|
|||
|
|
@ -2,13 +2,43 @@ name: Check for broken links
|
|||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- main
|
||||
paths:
|
||||
- "assets/**"
|
||||
- "**.html"
|
||||
- "**.js"
|
||||
- "**.liquid"
|
||||
- "**/*.md"
|
||||
- "**.yml"
|
||||
- "!.github/workflows/axe.yml"
|
||||
- "!.github/workflows/deploy-docker-tag.yml"
|
||||
- "!.github/workflows/deploy-image.yml"
|
||||
- "!.github/workflows/docker-slim.yml"
|
||||
- "!.github/workflows/prettier.yml"
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
- main
|
||||
paths:
|
||||
- "assets/**"
|
||||
- "**.html"
|
||||
- "**.js"
|
||||
- "**.liquid"
|
||||
- "**/*.md"
|
||||
- "**.yml"
|
||||
- "!.github/workflows/axe.yml"
|
||||
- "!.github/workflows/deploy-docker-tag.yml"
|
||||
- "!.github/workflows/deploy-image.yml"
|
||||
- "!.github/workflows/docker-slim.yml"
|
||||
- "!.github/workflows/prettier.yml"
|
||||
|
||||
jobs:
|
||||
link-checker:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Link Checker 🔗
|
||||
uses: lycheeverse/lychee-action@v1.9.0
|
||||
|
|
|
|||
|
|
@ -4,6 +4,13 @@ on:
|
|||
push:
|
||||
tags:
|
||||
- "v*"
|
||||
paths:
|
||||
- "bin/entry_point.sh"
|
||||
- "Dockerfile"
|
||||
- "Gemfile"
|
||||
- "Gemfile.lock"
|
||||
- "package.json"
|
||||
- "package-lock.json"
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
|
@ -11,28 +18,28 @@ jobs:
|
|||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
uses: docker/setup-qemu-action@v3
|
||||
|
||||
- name: Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Docker meta
|
||||
id: meta
|
||||
uses: docker/metadata-action@v4
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: amirpourmand/al-folio
|
||||
|
||||
- name: Login
|
||||
uses: docker/login-action@v2
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v3
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
platforms: linux/amd64,linux/arm64/v8
|
||||
|
|
|
|||
|
|
@ -2,7 +2,16 @@ name: Docker Image CI
|
|||
|
||||
on:
|
||||
push:
|
||||
branches: [master]
|
||||
branches:
|
||||
- master
|
||||
- main
|
||||
paths:
|
||||
- "bin/entry_point.sh"
|
||||
- "Dockerfile"
|
||||
- "Gemfile"
|
||||
- "Gemfile.lock"
|
||||
- "package.json"
|
||||
- "package-lock.json"
|
||||
|
||||
jobs:
|
||||
build:
|
||||
|
|
@ -11,22 +20,22 @@ jobs:
|
|||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v2
|
||||
uses: docker/setup-qemu-action@v3
|
||||
|
||||
- name: Buildx
|
||||
uses: docker/setup-buildx-action@v2
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Login
|
||||
uses: docker/login-action@v2
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v4
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
push: true
|
||||
|
|
|
|||
|
|
@ -1,14 +1,9 @@
|
|||
name: Deploy site
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- main
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
- main
|
||||
workflow_run:
|
||||
workflows: [Check for broken links]
|
||||
types: [completed]
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
|
|
@ -16,18 +11,20 @@ permissions:
|
|||
|
||||
jobs:
|
||||
deploy:
|
||||
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#running-a-workflow-based-on-the-conclusion-of-another-workflow
|
||||
if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' }}
|
||||
# available images: https://github.com/actions/runner-images#available-images
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout 🛎️
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
- name: Setup Ruby
|
||||
uses: ruby/setup-ruby@v1
|
||||
with:
|
||||
ruby-version: "3.2.2"
|
||||
ruby-version: "3.3"
|
||||
bundler-cache: true
|
||||
- name: Update _config.yml ⚙️
|
||||
uses: fjogeleit/yaml-update-action@v0.13.1
|
||||
uses: fjogeleit/yaml-update-action@main
|
||||
with:
|
||||
commitChange: false
|
||||
valueFile: "_config.yml"
|
||||
|
|
@ -37,9 +34,11 @@ jobs:
|
|||
run: |
|
||||
pip3 install --upgrade jupyter
|
||||
npm install -g mermaid.cli
|
||||
npm install -g purgecss
|
||||
export JEKYLL_ENV=production
|
||||
bundle exec jekyll build --lsi
|
||||
- name: Purge unused CSS 🧹
|
||||
run: |
|
||||
npm install -g purgecss
|
||||
purgecss -c purgecss.config.js
|
||||
- name: Deploy 🚀
|
||||
if: github.event_name != 'pull_request'
|
||||
|
|
|
|||
|
|
@ -14,19 +14,19 @@ on:
|
|||
|
||||
jobs:
|
||||
build:
|
||||
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#running-a-workflow-based-on-the-conclusion-of-another-workflow
|
||||
if: ${{ github.event.workflow_run.conclusion == 'success' }} and github.repository_owner == 'alshedivat'
|
||||
runs-on: ubuntu-latest
|
||||
if: github.repository_owner == 'alshedivat'
|
||||
|
||||
defaults:
|
||||
run:
|
||||
working-directory: ${{ github.workspace }}
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Login
|
||||
uses: docker/login-action@v2
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
|
|
@ -34,7 +34,7 @@ jobs:
|
|||
- name: update docker-compose
|
||||
shell: bash
|
||||
run: |
|
||||
sed -i "s|\.:|${{ github.workspace }}:|g" ${{ github.workspace }}/docker-compose.yml
|
||||
sed -i "s|\.:|${{ github.workspace }}:|g" ${{ github.workspace }}/docker-compose.yml
|
||||
cat ${{ github.workspace }}/docker-compose.yml
|
||||
|
||||
- uses: kitabisa/docker-slim-action@v1.0.3
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ jobs:
|
|||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout 🛎️
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
- name: Setup Node.js ⚙️
|
||||
uses: actions/setup-node@v4
|
||||
- name: Install Prettier 💾
|
||||
|
|
|
|||
|
|
@ -181,9 +181,9 @@ jobs:
|
|||
steps:
|
||||
# To use this repository's private action, you must check out the repository
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
uses: actions/checkout@v4
|
||||
- name: actions-template-sync
|
||||
uses: AndreasAugustin/actions-template-sync@v0.7.3
|
||||
uses: AndreasAugustin/actions-template-sync@v1
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
source_repo_path: alshedivat/al-folio
|
||||
|
|
|
|||
12
_config.yml
12
_config.yml
|
|
@ -206,13 +206,23 @@ kramdown:
|
|||
include: ["_pages"]
|
||||
exclude:
|
||||
- bin
|
||||
- CONTRIBUTING.md
|
||||
- CUSTOMIZE.md
|
||||
- docker-compose.yml
|
||||
- Dockerfile
|
||||
- FAQ.md
|
||||
- Gemfile
|
||||
- Gemfile.lock
|
||||
- INSTALL.md
|
||||
- LICENSE
|
||||
- package.json
|
||||
- package-lock.json
|
||||
- purgecss.config.js
|
||||
- README.md
|
||||
- vendor
|
||||
keep_files:
|
||||
- CNAME
|
||||
- .nojekyll
|
||||
- .git
|
||||
|
||||
# Plug-ins
|
||||
plugins:
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
module.exports = {
|
||||
content: ["_site/**/*.html", "_site/**/*.js"],
|
||||
content: ["_site/**.html", "_site/**.js"],
|
||||
css: ["_site/assets/css/*.css"],
|
||||
output: "_site/assets/css/",
|
||||
skippedContentGlobs: ["_site/assets/**/*.html"],
|
||||
skippedContentGlobs: ["_site/assets/**.html"],
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue