Skip to content

Commit

Permalink
feat: workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
jonalan7 committed Apr 6, 2023
1 parent 1ee567c commit 4ac92fd
Show file tree
Hide file tree
Showing 9 changed files with 297 additions and 15,880 deletions.
35 changes: 15 additions & 20 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: build
name: Build

on:
push:
Expand All @@ -12,29 +12,24 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Checkout code
uses: actions/checkout@v2

- name: Setup Node
uses: actions/setup-node@v3.2.0
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: 12.x
node-version: '12.x'

- name: Get npm cache directory
- name: Cache npm dependencies
id: npm-cache
run: |
echo "::set-output name=dir::$(npm config get cache)"
- name: Setup npm cache
uses: actions/cache@v3
uses: actions/cache@v2
with:
path: ${{ steps.npm-cache.outputs.dir }}
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Install Dependencies
run: npm ci || npm install
env:
PUPPETEER_SKIP_DOWNLOAD: true
restore-keys: ${{ runner.os }}-node-

- name: Build source
run: npm run build
- name: Install dependencies
run: npm ci

- name: Build source code
run: npm run build
18 changes: 14 additions & 4 deletions .github/workflows/commitlint.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
name: commit lint
on: [pull_request]

on:
pull_request:

jobs:
commitlint:
runs-on: ubuntu-latest
Expand All @@ -10,7 +12,15 @@ jobs:
with:
fetch-depth: 0

- name: Lint commit
uses: wagoid/commitlint-github-action@v2
- name: Setup Node.js
uses: actions/setup-node@v2
with:
configFile: './.commitlintrc.js'
node-version: 14.x

- name: Install dependencies
run: |
npm install -g @commitlint/cli
npm install
- name: Lint commit
run: commitlint --config .commitlintrc.js --from=HEAD~1
19 changes: 12 additions & 7 deletions .github/workflows/issues.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: Close inactive issues

on:
schedule:
- cron: "30 1 * * *"
Expand All @@ -10,13 +11,17 @@ jobs:
issues: write
pull-requests: write
steps:
- uses: actions/stale@v5
- name: Check for stale issues and pull requests
uses: "pascalgn/[email protected]"
with:
days-before-issue-stale: 10
days-before-issue-close: 10
stale-issue-label: "stale"
stale-issue-message: "This issue is stale because it has been open for 30 days with no activity."
close-issue-message: "This issue was closed because it has been inactive for 14 days since being marked as stale."
stale-issue-message: "This issue is stale because it has been open for 10 days with no activity."
close-issue-message: "This issue was closed because it has been inactive for 10 days since being marked as stale."
stale-pr-message: "This pull request is stale because it has not been updated for 10 days."
close-pr-message: "This pull request was closed because it has been inactive for 10 days since being marked as stale."
days-before-stale: 10
days-before-close: 10
days-before-pr-stale: -1
days-before-pr-close: -1
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-label: "stale"
exempt-label: "in progress"
repo-token: "${{ secrets.GITHUB_TOKEN }}"
61 changes: 49 additions & 12 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,27 @@
name: lint
name: Publish

on:
push:
branches:
- '*'
pull_request:
branches:
- '*'
tags:
- 'v*'

jobs:
lint:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup Node
uses: actions/setup-node@v1
- name: Fetch tags
run: git fetch --tags -f || true

- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version: 12.x
registry-url: 'https://registry.npmjs.org'
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Get npm cache directory
id: npm-cache
Expand All @@ -33,9 +36,43 @@ jobs:
${{ runner.os }}-node-
- name: Install Dependencies
run: npm ci || npm install
run: npm ci --no-progress || npm install --no-progress
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
PUPPETEER_SKIP_DOWNLOAD: true

- name: Lint source
run: npm run lint
- name: Publish to NPM
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Generate Changelog
id: generate_changelog
run: |
changelog=$(npm run changelog:last --silent)
changelog="${changelog//$'\n'/'%0A'}"
changelog="${changelog//$'\r'/'%0D'}"
echo "::set-output name=changelog::${changelog}\n"
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
body: ${{ steps.generate_changelog.outputs.changelog }}
draft: false
prerelease: false

- name: Build API Docs
run: npm run docs:build || true
continue-on-error: true

- name: Deploy API Docs
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./api-docs
continue-on-error: true
63 changes: 53 additions & 10 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,53 @@
- name: Update nightly release
run: |
echo -e "ref: $GITHUB_REF \ncommit: $GITHUB_SHA\nbuild: $(date +"%Y-%m-%dT%H:%M:%SZ")" \
> build/libs/info.txt
uses: eine/tip@master
with:
tag: nightly
rm: true
token: ${{ secrets.GITHUB_TOKEN }}
files: build/libs/*.*
name: Update nightly release
on:
push:
branches:
- main
schedule:
- cron: '0 0 * * *' # Executa a meia-noite de cada dia

jobs:
update-nightly-release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup Java
uses: actions/setup-java@v2
with:
java-version: 11

- name: Install Dependencies
run: ./gradlew clean build

- name: Update info.txt
run: |
echo -e "ref: ${{ github.ref }}\ncommit: ${{ github.sha }}\nbuild: $(date +'%Y-%m-%dT%H:%M:%SZ')" > build/libs/info.txt
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: nightly-build
path: build/libs/

- name: Create Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: nightly
release_name: Nightly Build
body: Automated nightly build for branch ${{ github.ref }}
draft: false
prerelease: true

- name: Attach Artifacts to Release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: build/libs/
asset_name: nightly-build
asset_content_type: application/zip
50 changes: 20 additions & 30 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,39 +10,32 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Fetching tags
run: git fetch --tags -f || true
uses: actions/checkout@v2

- name: Setup Node
uses: actions/setup-node@v3.2.0
- name: Setup Node.js
uses: actions/setup-node@v2.5.2
with:
node-version: 12.x
node-version: '12.x'
registry-url: 'https://registry.npmjs.org'
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Get npm cache directory
id: npm-cache
run: |
echo "::set-output name=dir::$(npm config get cache)"
- name: Setup npm cache
uses: actions/cache@v3
run: echo "::set-output name=dir::$(npm config get cache)"

- name: Cache dependencies
uses: actions/cache@v2
with:
path: ${{ steps.npm-cache.outputs.dir }}
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
restore-keys: ${{ runner.os }}-node-

- name: Install Dependencies
run: npm ci || npm install
run: npm ci
env:
PUPPETEER_SKIP_DOWNLOAD: true
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
PUPPETEER_SKIP_DOWNLOAD: true

- name: Publish in NPM
- name: Publish to npm
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
Expand All @@ -52,28 +45,25 @@ jobs:
run: |
changelog=$(npm run changelog:last --silent)
changelog="${changelog//$'\n'/'%0A'}"
changelog="${changelog//$'\r'/'%0D'}"
echo -e "set-output name=changelog::${changelog-<empty>}\n"
changelog="${changelog//$'\r'/'%0D'}"
echo -e "::set-output name=changelog::${changelog}\n"
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
body: ${{ steps.generate_changelog.outputs.changelog }}
draft: false
prerelease: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Build API-Docs
- name: Build API Docs
run: npm run docs:build
continue-on-error: true

- name: Deploy API-Docs
- name: Deploy API Docs
uses: peaceiris/actions-gh-pages@v3
continue-on-error: true
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./api-docs
continue-on-error: true
2 changes: 1 addition & 1 deletion .prettierrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"singleQuote": true,
"endOfLine": "crlf",
"endOfLine": "auto",
"useTabs": false,
"trailingComma": "none"
}
Loading

0 comments on commit 4ac92fd

Please sign in to comment.