Skip to content

Commit

Permalink
chore(misc): add eslint-plugin-yml, npm cache (DIYgod#8599)
Browse files Browse the repository at this point in the history
  • Loading branch information
TonyRL authored Nov 27, 2021
1 parent 6e810ad commit 74db039
Show file tree
Hide file tree
Showing 19 changed files with 333 additions and 234 deletions.
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,6 @@ trim_trailing_whitespace = false
# Matches the exact files either package.json or .travis.yml
[{package.json,.travis.yml}]
indent_size = 2

[{**.yml,**.yaml}]
indent_size = 2
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
coverage
.vscode
docker-compose.yml
!/.github
10 changes: 8 additions & 2 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"extends": ["eslint:recommended", "plugin:prettier/recommended"],
"extends": ["eslint:recommended", "plugin:prettier/recommended", "plugin:yml/recommended"],
"plugins": ["prettier"],
"parserOptions": {
"ecmaVersion": 2020,
Expand Down Expand Up @@ -66,6 +66,12 @@
"no-new-func": 2,
"require-await": 2,
"prefer-arrow-callback": 2,
"object-shorthand": 2
"object-shorthand": 2,
"yml/quotes": [
"error",
{
"prefer": "single"
}
]
}
}
2 changes: 1 addition & 1 deletion .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# These are supported funding model platforms
github: DIYgod
patreon: DIYgod
custom: ["https://afdian.net/@diygod", "https://diygod.me/images/zfb.jpg", "https://diygod.me/images/wx.jpg"]
custom: ['https://afdian.net/@diygod', 'https://diygod.me/images/zfb.jpg', 'https://diygod.me/images/wx.jpg']
108 changes: 59 additions & 49 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,51 +1,61 @@
version: 2
updates:
- package-ecosystem: npm
directory: "/"
schedule:
interval: daily
time: "21:00"
open-pull-requests-limit: 10
reviewers:
- DIYgod
labels:
- dependencies
ignore:
- dependency-name: cheerio
versions:
- "> 1.0.0-rc.5"
- dependency-name: remark
versions:
- "> 12.0.1"
- dependency-name: remark
versions:
- "> 13.0.0, < 13.1"
- dependency-name: remark-frontmatter
versions:
- "> 2.0.0"
- dependency-name: remark-frontmatter
versions:
- ">= 3.0.a, < 3.1"
- dependency-name: "@sentry/node"
versions:
- 6.0.4
- 6.2.3
- 6.3.1
- dependency-name: eslint
versions:
- 7.24.0
- dependency-name: ioredis
versions:
- 4.24.1
- dependency-name: string-width
versions:
- 4.2.1
- dependency-name: nock
versions:
- 13.0.8
- dependency-name: googleapis
versions:
- 67.1.0
- dependency-name: rss-parser
versions:
- 3.11.0
- package-ecosystem: npm
directory: '/'
schedule:
interval: daily
time: '21:00'
open-pull-requests-limit: 10
reviewers:
- DIYgod
labels:
- dependencies
ignore:
- dependency-name: cheerio
versions:
- '> 1.0.0-rc.5'
- dependency-name: remark
versions:
- '> 12.0.1'
- dependency-name: remark
versions:
- '> 13.0.0, < 13.1'
- dependency-name: remark-frontmatter
versions:
- '> 2.0.0'
- dependency-name: remark-frontmatter
versions:
- '>= 3.0.a, < 3.1'
- dependency-name: '@sentry/node'
versions:
- 6.0.4
- 6.2.3
- 6.3.1
- dependency-name: eslint
versions:
- 7.24.0
- dependency-name: ioredis
versions:
- 4.24.1
- dependency-name: string-width
versions:
- 4.2.1
- dependency-name: nock
versions:
- 13.0.8
- dependency-name: googleapis
versions:
- 67.1.0
- dependency-name: rss-parser
versions:
- 3.11.0
- package-ecosystem: 'github-actions'
directory: '/'
schedule:
interval: daily
time: '21:00'
open-pull-requests-limit: 10
reviewers:
- DIYgod
labels:
- dependencies
5 changes: 3 additions & 2 deletions .github/workflows/build-assets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,14 @@ jobs:
- name: Checkout
uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- name: build file
run: npm ci && npm run build:all
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./assets
publish_dir: ./assets
2 changes: 1 addition & 1 deletion .github/workflows/comment-on-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ jobs:
uses: ben-z/actions-comment-on-issue@1.0.2
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
message: "👍 感谢提交该 Issue,请确保仔细阅读 [Issue 模板](https://github.com/DIYgod/RSSHub/blob/master/.github/ISSUE_TEMPLATE/bug_report_zh.md),[RSS 提案模板](https://github.com/DIYgod/RSSHub/blob/master/.github/ISSUE_TEMPLATE/rss_request_zh.md) 或 [Feature 提案模板](https://github.com/DIYgod/RSSHub/blob/master/.github/ISSUE_TEMPLATE/feature_request_zh.md) 以便于测试。不符合模板将导致 Issue 被直接关闭。<br /><br />👍 Thanks for the issue, please follow the [Issue template](https://github.com/DIYgod/RSSHub/blob/master/.github/ISSUE_TEMPLATE/bug_report_en.md), [RSS proposal template](https://github.com/DIYgod/RSSHub/blob/master/.github/ISSUE_TEMPLATE/rss_request_zh.md) or [Feature proposal template](https://github.com/DIYgod/RSSHub/blob/master/.github/ISSUE_TEMPLATE/feature_request_en.md). Otherwise the issue will be closed."
message: '👍 感谢提交该 Issue,请确保仔细阅读 [Issue 模板](https://github.com/DIYgod/RSSHub/blob/master/.github/ISSUE_TEMPLATE/bug_report_zh.md),[RSS 提案模板](https://github.com/DIYgod/RSSHub/blob/master/.github/ISSUE_TEMPLATE/rss_request_zh.md) 或 [Feature 提案模板](https://github.com/DIYgod/RSSHub/blob/master/.github/ISSUE_TEMPLATE/feature_request_zh.md) 以便于测试。不符合模板将导致 Issue 被直接关闭。<br /><br />👍 Thanks for the issue, please follow the [Issue template](https://github.com/DIYgod/RSSHub/blob/master/.github/ISSUE_TEMPLATE/bug_report_en.md), [RSS proposal template](https://github.com/DIYgod/RSSHub/blob/master/.github/ISSUE_TEMPLATE/rss_request_zh.md) or [Feature proposal template](https://github.com/DIYgod/RSSHub/blob/master/.github/ISSUE_TEMPLATE/feature_request_en.md). Otherwise the issue will be closed.'
69 changes: 34 additions & 35 deletions .github/workflows/docker-release.yml
Original file line number Diff line number Diff line change
@@ -1,41 +1,40 @@
name: '[docker] CI for releases'

on:
push:
branches: master
paths:
- 'lib/**'
- '.github/workflows/**'
- 'Dockerfile'
- 'package.json'
push:
branches:
- master
paths:
- 'lib/**'
- '.github/workflows/**'
- 'Dockerfile'
- 'package.json'

jobs:
release:
runs-on: ubuntu-latest
steps:
-
name: Checkout
uses: actions/checkout@v2
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Checkout
uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
-
name: Build dockerfile (with push)
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
run: |
docker buildx build \
--platform=linux/amd64,linux/arm/v7,linux/arm64 \
--output "type=image,push=true" \
--file ./Dockerfile . \
--tag $(echo "${DOCKER_USERNAME}" | tr '[:upper:]' '[:lower:]')/rsshub:latest \
--tag $(echo "${DOCKER_USERNAME}" | tr '[:upper:]' '[:lower:]')/rsshub:$(date +%Y)-$(date +%m)-$(date +%d)
- name: Checkout
uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build dockerfile (with push)
env:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
run: |
docker buildx build \
--platform=linux/amd64,linux/arm/v7,linux/arm64 \
--output "type=image,push=true" \
--file ./Dockerfile . \
--tag $(echo "${DOCKER_USERNAME}" | tr '[:upper:]' '[:lower:]')/rsshub:latest \
--tag $(echo "${DOCKER_USERNAME}" | tr '[:upper:]' '[:lower:]')/rsshub:$(date +%Y)-$(date +%m)-$(date +%d)
48 changes: 25 additions & 23 deletions .github/workflows/docker-test.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,29 @@
name: '[docker] CI for build tests'

on:
pull_request:
branches: master
paths:
- 'lib/**'
- 'Dockerfile'
- 'package.json'
# Please, always create a pull request instead of push to master.
pull_request:
branches:
- master
paths:
- 'lib/**'
- 'Dockerfile'
- 'package.json'

# Please, always create a pull request instead of push to master.
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build dockerfile and Run (without push)
run: |
docker build \
--tag rsshub:latest \
--file ./Dockerfile .
chmod +x scripts/docker/test-docker.sh
scripts/docker/test-docker.sh
test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build dockerfile and Run (without push)
run: |
docker build \
--tag rsshub:latest \
--file ./Dockerfile .
chmod +x scripts/docker/test-docker.sh
scripts/docker/test-docker.sh
30 changes: 15 additions & 15 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@ name: format

on:
push:
branches: master
branches:
- master

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '14'
cache: 'npm'
- run: yarn install
- run: npm run format
- name: Commit files
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git status
git diff-index --quiet HEAD || (git commit -m "style: auto format" -a --no-verify && git push "https://${GITHUB_ACTOR}:${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git" HEAD:master)
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '14'
cache: 'npm'
- run: yarn install
- run: npm run format
- name: Commit files
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git status
git diff-index --quiet HEAD || (git commit -m "style: auto format" -a --no-verify && git push "https://${GITHUB_ACTOR}:${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git" HEAD:master)
35 changes: 18 additions & 17 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,28 @@ name: publish

on:
push:
branches: master
branches:
- master
paths:
- 'lib/**'
- 'lib/**'

jobs:
build:
if: github.repository == 'DIYgod/RSSHub'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '14'
cache: 'npm'
registry-url: 'https://registry.npmjs.org'
- name: Release
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
npx version-from-git --allow-same-version --template 'master.short'
- name: Publish to npmjs
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '14'
cache: 'npm'
registry-url: 'https://registry.npmjs.org'
- name: Release
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
npx version-from-git --allow-same-version --template 'master.short'
- name: Publish to npmjs
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
Loading

0 comments on commit 74db039

Please sign in to comment.