Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 25 additions & 21 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,43 @@ name: CD

on:
push:
branches:
- production
tags-ignore:
- "**"
branches: [production]
tags-ignore: ["**"]

jobs:
release:
if: ${{ ! startsWith(github.event.head_commit.message, 'chore(release)') }}
permissions:
contents: write
issues: write
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: echo "CD running..."

- uses: ruby/setup-ruby@v1
with:
ruby-version: 3.3
bundler-cache: true
# - uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: lts/*
# - uses: ruby/setup-ruby@v1
# with:
# ruby-version: 3.3
# bundler-cache: true

- run: npm install
- run: npx semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GEM_HOST_API_KEY: ${{ secrets.GEM_HOST_API_KEY }}
# - uses: actions/setup-node@v4
# with:
# node-version: lts/*

# - run: npm install
# - run: npx semantic-release
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# GEM_HOST_API_KEY: ${{ secrets.GEM_HOST_API_KEY }}

publish:
needs: release
uses: ./.github/workflows/publish.yml
secrets:
GH_PAT: ${{ secrets.GH_PAT }}
BUILDER: ${{ secrets.BUILDER }}
# uses: ./.github/workflows/publish.yml
# secrets:
# GH_PAT: ${{ secrets.GH_PAT }}
# BUILDER: ${{ secrets.BUILDER }}
runs-on: ubuntu-latest
steps:
- run: echo 'Publishing...'
25 changes: 13 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
name: "CI"
name: CI

on:
push:
branches:
- "master"
- "hotfix/**"
branches-ignore: [production]
paths-ignore:
- ".github/**"
- "!.github/workflows/ci.yml"
- ".gitignore"
- .gitignore
- "docs/**"
- "README.md"
- "LICENSE"
workflow_call:
- README.md
- LICENSE
pull_request:
paths-ignore:
- ".github/**"
- "!.github/workflows/ci.yml"
- .gitignore
- "docs/**"
- README.md
- LICENSE

jobs:
build:
Expand Down Expand Up @@ -44,7 +49,3 @@ jobs:

- name: Test Site
run: bash tools/test.sh

check-commit:
needs: build
uses: ./.github/workflows/commitlint.yml
5 changes: 4 additions & 1 deletion .github/workflows/commitlint.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name: Lint Commit Messages

on: workflow_call
on:
push:
branches-ignore: [production]
pull_request:

jobs:
commitlint:
Expand Down
11 changes: 1 addition & 10 deletions .github/workflows/pr-filter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,6 @@ jobs:
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
result-encoding: string
script: |
const script = require('.github/workflows/scripts/pr-filter.js');
return await script({ github, context });

- name: Abort due to invalid PR
if: ${{ steps.intercept.outputs.result != 'true' }}
run: exit 1

test:
needs: check-template
uses: ./.github/workflows/ci.yml
await script({ github, context, core });
1 change: 1 addition & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ on:
required: true
BUILDER:
required: true
workflow_dispatch:

jobs:
launch:
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/scripts/pr-filter.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
function hasTypes(markdown) {
return /## Type of change/.test(markdown) && /-\s*\[x\]/i.test(markdown);
return /## Type of change/.test(markdown) && /-\s\[x\]/i.test(markdown);
}

function hasDescription(markdown) {
Expand All @@ -9,14 +9,14 @@ function hasDescription(markdown) {
);
}

module.exports = async ({ github, context }) => {
module.exports = async ({ github, context, core }) => {
const pr = context.payload.pull_request;
const body = pr.body === null ? '' : pr.body.trim();
const body = pr.body === null ? '' : pr.body;
const markdown = body.replace(/<!--[\s\S]*?-->/g, '');
const action = context.payload.action;

const isValid =
pr.labels.length > 0 || // PR create by Dependabot would have labels
pr.base.repo.full_name === pr.head.repo.full_name ||
(markdown !== '' && hasTypes(markdown) && hasDescription(markdown));

if (!isValid) {
Expand All @@ -31,7 +31,7 @@ module.exports = async ({ github, context }) => {
issue_number: pr.number,
body: `Oops, it seems you've ${action} an invalid pull request. No worries, we'll close it for you.`
});
}

return isValid;
core.setFailed('PR content does not meet template requirements.');
}
};
4 changes: 2 additions & 2 deletions .github/workflows/style-lint.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
name: "Style Lint"
name: Style Lint

on:
push:
branches: ["master", "hotfix/**"]
branches-ignore: [production]
paths: ["_sass/**/*.scss"]
pull_request:
paths: ["_sass/**/*.scss"]
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@

</div>

<!-- hidden -->

## Features

- Dark Theme
Expand Down
4 changes: 2 additions & 2 deletions tools/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,9 @@ main() {
exit 0
fi

build_gem
# build_gem
$opt_pkg && exit 0
push_gem
# push_gem
merge
}

Expand Down
Loading