Skip to content

Commit

Permalink
ci/cd: refactor workflows and adopt scripts for new docs structure
Browse files Browse the repository at this point in the history
  • Loading branch information
kamilsk committed May 9, 2023
1 parent 56da32f commit 2f41ae6
Show file tree
Hide file tree
Showing 11 changed files with 53 additions and 27 deletions.
15 changes: 15 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,21 @@ updates:
include: 'scope'
open-pull-requests-limit: 30

- package-ecosystem: npm
directory: /docs/
schedule:
interval: daily
time: '05:00'
timezone: UTC
labels:
- 'type: improvement'
- 'scope: docs'
- 'scope: deps'
commit-message:
prefix: 'docs'
include: 'scope'
open-pull-requests-limit: 30

- package-ecosystem: npm
directory: /tools/
schedule:
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/caches.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
- name: Install a GitHub CLI cache extension
run: gh extension install actions/gh-actions-cache
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ github.token }}
- name: Cleanup caches
run: |
keys=$(gh actions-cache list -L 100 -R '${{ github.repository }}' | cut -f1)
Expand All @@ -37,7 +37,7 @@ jobs:
done
echo Done
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ github.token }}

notify:
name: Notifying
Expand All @@ -55,9 +55,10 @@ jobs:

- name: Send Slack notification
uses: rtCamp/action-slack-notify@v2
continue-on-error: true
env:
SLACK_COLOR: ${{ contains(needs.*.result, 'failure') && 'failure' || 'success' }}
SLACK_FOOTER: made with ❤️ for everyone, OctoLab
SLACK_FOOTER: made with ❤️ for everyone by OctoLab
SLACK_ICON: https://github.com/github.png?size=64
SLACK_MESSAGE: ${{ steps.message.outputs.txt }}
SLACK_TITLE: '🧹 ${{ github.repository }}: ${{ github.workflow }}'
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/cd.docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,10 @@ jobs:

- name: Send Slack notification
uses: rtCamp/action-slack-notify@v2
continue-on-error: true
env:
SLACK_COLOR: ${{ contains(needs.*.result, 'failure') && 'failure' || 'success' }}
SLACK_FOOTER: made with ❤️ for everyone, OctoLab
SLACK_FOOTER: made with ❤️ for everyone by OctoLab
SLACK_ICON: https://github.com/github.png?size=64
SLACK_MESSAGE: ${{ steps.message.outputs.txt }}
SLACK_TITLE: '🐳 ${{ github.repository }}: ${{ github.workflow }}'
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/cd.vercel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,10 @@ jobs:

- name: Send Slack notification
uses: rtCamp/action-slack-notify@v2
continue-on-error: true
env:
SLACK_COLOR: ${{ contains(needs.*.result, 'failure') && 'failure' || 'success' }}
SLACK_FOOTER: made with ❤️ for everyone, OctoLab
SLACK_FOOTER: made with ❤️ for everyone by OctoLab
SLACK_ICON: https://github.com/github.png?size=64
SLACK_MESSAGE: ${{ steps.message.outputs.txt }}
SLACK_TITLE: '🚀 ${{ github.repository }}: ${{ github.workflow }}'
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ on:
- '**.tsx?'
tags: [ '!*' ]

schedule:
- name: At 07:00 on day-of-month 1, UTC
cron: 0 7 1 * *

jobs:
build:
name: Building
Expand Down Expand Up @@ -80,9 +84,10 @@ jobs:

- name: Send Slack notification
uses: rtCamp/action-slack-notify@v2
continue-on-error: true
env:
SLACK_COLOR: ${{ contains(needs.*.result, 'failure') && 'failure' || 'success' }}
SLACK_FOOTER: made with ❤️ for everyone, OctoLab
SLACK_FOOTER: made with ❤️ for everyone by OctoLab
SLACK_ICON: https://github.com/github.png?size=64
SLACK_MESSAGE: ${{ steps.message.outputs.txt }}
SLACK_TITLE: '⚙️ ${{ github.repository }}: ${{ github.workflow }}'
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/deps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- name: Emulate dependabot's update process
run: |
envsubst <.github/integrations/dependabot/job.yml >/tmp/job.yml
dependabot update -f /tmp/job.yml --dry-run
dependabot update -f /tmp/job.yml
env:
GITHUB_REPOSITORY: ${{ github.repository }}
LOCAL_GITHUB_ACCESS_TOKEN: ${{ secrets.DEPENDABOT_TOKEN }}
Expand All @@ -51,9 +51,10 @@ jobs:

- name: Send Slack notification
uses: rtCamp/action-slack-notify@v2
continue-on-error: true
env:
SLACK_COLOR: ${{ contains(needs.*.result, 'failure') && 'failure' || 'success' }}
SLACK_FOOTER: made with ❤️ for everyone, OctoLab
SLACK_FOOTER: made with ❤️ for everyone by OctoLab
SLACK_ICON: https://github.com/github.png?size=64
SLACK_MESSAGE: ${{ steps.message.outputs.txt }}
SLACK_TITLE: '🤖 ${{ github.repository }}: ${{ github.workflow }}'
Expand Down
25 changes: 13 additions & 12 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,12 @@ on:
paths:
- '.github/workflows/docs.yml'
- 'docs/**/*'
- 'tools/pages/**/*'
- 'tools/*.jsx?'
- 'tools/package*.json'
tags: [ '!*' ]

schedule:
- name: At 07:00 on day-of-month 1, UTC
cron: 0 7 1 * *

concurrency:
group: pages
cancel-in-progress: false
Expand All @@ -37,21 +38,21 @@ jobs:
- name: Set up GitHub Pages
uses: actions/configure-pages@v3

- name: Cache tooling dependencies
id: tools
- name: Cache documentation dependencies
id: docs
uses: actions/cache@v3
with:
path: ./tools/node_modules
key: tools-${{ hashFiles('tools/package-lock.json') }}
- name: Install tooling dependencies if needed
path: ./docs/node_modules
key: docs-${{ hashFiles('docs/package-lock.json') }}
- name: Install documentation dependencies if needed
run: ./Taskfile docs install
if: steps.tools.outputs.cache-hit != 'true'
if: steps.docs.outputs.cache-hit != 'true'

- name: Build static HTML with Next.js
run: ./Taskfile docs build publish
run: ./Taskfile docs publish
- name: Upload the documentation
uses: actions/upload-pages-artifact@v1
with: { path: docs }
with: { path: docs/dist }

deploy:
name: Deploying
Expand Down Expand Up @@ -89,7 +90,7 @@ jobs:
continue-on-error: true
env:
SLACK_COLOR: ${{ contains(needs.*.result, 'failure') && 'failure' || 'success' }}
SLACK_FOOTER: made with ❤️ for everyone, OctoLab
SLACK_FOOTER: made with ❤️ for everyone by OctoLab
SLACK_ICON: https://github.com/github.png?size=64
SLACK_MESSAGE: ${{ steps.message.outputs.txt }}
SLACK_TITLE: '📚 ${{ github.repository }}: ${{ github.workflow }}'
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/runs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ on:
options:
- All
- Cache invalidation
- Continuous integration
- Continuous delivery (Vercel)
- Continuous delivery (Docker)
- Continuous integration
- Dependabot at weekends
- Documentation delivery
- Issue invalidation
Expand Down Expand Up @@ -63,9 +63,10 @@ jobs:

- name: Send Slack notification
uses: rtCamp/action-slack-notify@v2
continue-on-error: true
env:
SLACK_COLOR: ${{ contains(needs.*.result, 'failure') && 'failure' || 'success' }}
SLACK_FOOTER: made with ❤️ for everyone, OctoLab
SLACK_FOOTER: made with ❤️ for everyone by OctoLab
SLACK_ICON: https://github.com/github.png?size=64
SLACK_MESSAGE: ${{ steps.message.outputs.txt }}
SLACK_TITLE: '🗑️ ${{ github.repository }}: ${{ github.workflow }}'
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,10 @@ jobs:

- name: Send Slack notification
uses: rtCamp/action-slack-notify@v2
continue-on-error: true
env:
SLACK_COLOR: ${{ contains(needs.*.result, 'failure') && 'failure' || 'success' }}
SLACK_FOOTER: made with ❤️ for everyone, OctoLab
SLACK_FOOTER: made with ❤️ for everyone by OctoLab
SLACK_ICON: https://github.com/github.png?size=64
SLACK_MESSAGE: ${{ steps.message.outputs.txt }}
SLACK_TITLE: '⚠️ ${{ github.repository }}: ${{ github.workflow }}'
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,4 +175,4 @@ See [CLA][] to see the full text.
[CLA assistant]: https://cla-assistant.io/tact-app/web
[CLA assistant.src]: https://github.com/cla-assistant/cla-assistant

<p align="right">made with ❤️ for everyone</p>
<p align="right">made with ❤️ for everyone by OctoLab</p>
5 changes: 2 additions & 3 deletions Taskfile
Original file line number Diff line number Diff line change
Expand Up @@ -305,7 +305,7 @@ function docs() {
# dirty hack related to "docker: open .env: no such file or directory"
unset -f npm

pushd tools
pushd docs
trap popd EXIT

local args=("${@}")
Expand Down Expand Up @@ -333,9 +333,8 @@ function docs() {
;;

publish)
rm -rf ../docs/*
rm -rf dist/
TARGET=static npx --no-install next build
git checkout ../docs/CNAME ../docs/redirects
;;

*) break ;;
Expand Down

0 comments on commit 2f41ae6

Please sign in to comment.