Skip to content

Commit

Permalink
build: use cache for docker, update release logic
Browse files Browse the repository at this point in the history
  • Loading branch information
RaunoT committed Aug 16, 2024
1 parent 9f3d86d commit ccab0ff
Show file tree
Hide file tree
Showing 8 changed files with 330 additions and 8 deletions.
38 changes: 38 additions & 0 deletions .cz-config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
module.exports = {
types: [
{ value: 'feat', name: 'feat: A new feature' },
{ value: 'fix', name: 'fix: A bug fix' },
{ value: 'ui', name: 'ui: Changes related to the UI' },
{
value: 'perf',
name: 'perf: A code change that improves performance',
},
{ value: 'docs', name: 'docs: Documentation only changes' },
{ value: 'revert', name: 'revert: Revert a previous commit' },
{
value: 'chore',
name: 'chore: Changes to auxiliary tools such as libraries and dependencies',
},
{
value: 'refactor',
name: 'refactor: A code change that neither fixes a bug nor adds a feature',
},
{
value: 'build',
name: 'build: Changes that affect the build system or external dependencies\n (example scopes: docker, pnpm)',
},
{
value: 'style',
name: 'style: Changes that do not affect the meaning of the code\n (white-space, formatting, missing semi-colons, etc)',
},
{
value: 'ci',
name: 'ci: Changes to our CI configuration files and scripts\n (example scope: gh-actions)',
},
{
value: 'test',
name: 'test: Adding missing tests or correcting existing tests',
},
],
scopes: [{ name: 'rewind' }, { name: 'dashboard' }, { name: 'config' }],
}
11 changes: 11 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Cache Docker layers
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-develop-${{ hashFiles('Dockerfile') }}
restore-keys: |
${{ runner.os }}-buildx-develop-${{ hashFiles('Dockerfile') }}
${{ runner.os }}-buildx-develop-
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
Expand All @@ -33,3 +42,5 @@ jobs:
ghcr.io/raunot/plex-rewind:${{ github.sha }}
build-args: |
NEXT_PUBLIC_VERSION_TAG=${{ github.sha }}
cache-from: type=gha,scope=plex-rewind-develop
cache-to: type=gha,mode=max,scope=plex-rewind-develop
11 changes: 11 additions & 0 deletions .github/workflows/pre-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,15 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Cache Docker layers
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-develop-${{ hashFiles('Dockerfile') }}
restore-keys: |
${{ runner.os }}-buildx-develop-${{ hashFiles('Dockerfile') }}
${{ runner.os }}-buildx-develop-
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
Expand All @@ -56,6 +65,8 @@ jobs:
ghcr.io/raunot/plex-rewind:${{ env.NEXT_VERSION_TAG }}
build-args: |
NEXT_PUBLIC_VERSION_TAG=${{ env.NEXT_VERSION_TAG }}
cache-from: type=gha,scope=plex-rewind-develop
cache-to: type=gha,mode=max,scope=plex-rewind-develop

- name: Run Semantic Release publish
env:
Expand Down
11 changes: 11 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,15 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Cache Docker layers
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-main-${{ hashFiles('Dockerfile') }}
restore-keys: |
${{ runner.os }}-buildx-main-${{ hashFiles('Dockerfile') }}
${{ runner.os }}-buildx-main-
- name: Log in to GitHub Container Registry
uses: docker/login-action@v3
with:
Expand All @@ -57,6 +66,8 @@ jobs:
ghcr.io/raunot/plex-rewind:${{ env.NEXT_VERSION_TAG }}
build-args: |
NEXT_PUBLIC_VERSION_TAG=${{ env.NEXT_VERSION_TAG }}
cache-from: type=gha,scope=plex-rewind-main
cache-to: type=gha,mode=max,scope=plex-rewind-main

- name: Run Semantic Release publish
env:
Expand Down
44 changes: 42 additions & 2 deletions .releaserc.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,47 @@
{
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
[
"@semantic-release/commit-analyzer",
{
"preset": "conventionalcommits",
"releaseRules": [
{ "type": "feat", "release": "minor" },
{ "type": "fix", "release": "patch" },
{ "type": "ui", "release": "patch" },
{ "type": "perf", "release": "patch" },
{ "type": "docs", "release": false },
{ "type": "revert", "release": "patch" },
{ "type": "chore", "release": "patch" },
{ "type": "refactor", "release": "patch" },
{ "type": "build", "release": "patch" },
{ "type": "style", "release": false },
{ "type": "ci", "release": false },
{ "type": "test", "release": false }
]
}
],
[
"@semantic-release/release-notes-generator",
{
"preset": "conventionalcommits",
"writerOpts": {
"types": [
{ "type": "feat", "section": "🚀 Features" },
{ "type": "fix", "section": "🐛 Bug Fixes" },
{ "type": "ui", "section": "🎨 UI Changes" },
{ "type": "perf", "section": "⚡ Performance Improvements" },
{ "type": "docs", "section": "📝 Documentation" },
{ "type": "revert", "section": "⏪ Reverts" },
{ "type": "chore", "section": "🛠️ Other Changes" },
{ "type": "refactor", "section": "🛠️ Other Changes" },
{ "type": "build", "section": "🛠️ Other Changes" },
{ "type": "style", "section": "🛠️ Other Changes" },
{ "type": "ci", "section": "🛠️ Other Changes" },
{ "type": "test", "section": "🛠️ Other Changes" }
]
}
}
],
"@semantic-release/github",
[
"@semantic-release/exec",
Expand Down
24 changes: 23 additions & 1 deletion commitlint.config.js
Original file line number Diff line number Diff line change
@@ -1 +1,23 @@
module.exports = { extends: ['@commitlint/config-conventional'] }
module.exports = {
extends: ['@commitlint/config-conventional'],
rules: {
'type-enum': [
2,
'always',
[
'feat',
'fix',
'ui',
'perf',
'docs',
'revert',
'chore',
'refactor',
'build',
'style',
'ci',
'test',
],
],
},
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
},
"config": {
"commitizen": {
"path": "./node_modules/cz-conventional-changelog"
"path": "./node_modules/cz-customizable"
}
},
"dependencies": {
Expand Down Expand Up @@ -57,7 +57,7 @@
"autoprefixer": "^10.4.20",
"clsx": "^2.1.1",
"commitizen": "^4.3.0",
"cz-conventional-changelog": "^3.3.0",
"cz-customizable": "7.2.1",
"eslint": "^8.57.0",
"eslint-config-next": "^14.2.5",
"eslint-config-prettier": "^9.1.0",
Expand Down
Loading

0 comments on commit ccab0ff

Please sign in to comment.