-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
1,690 additions
and
2,186 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,159 @@ | ||
name: DevOps | ||
on: | ||
[push, pull_request] | ||
|
||
env: | ||
nodeLastVersion: '20.X' | ||
|
||
jobs: | ||
|
||
############################################################################## | ||
# Test application | ||
# | ||
test_nodejs: | ||
runs-on: ubuntu-latest | ||
name: Build and test | ||
strategy: | ||
matrix: | ||
node-version: [18.X, 20.X, 21.X] | ||
steps: | ||
- name: Git checkout | ||
uses: actions/checkout@v4.1.1 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- name: Install globally grunt-cli | ||
run: npm install -g grunt-cli | ||
- name: Install other dependencies | ||
run: npm install | ||
- name: Run tests (QA and unit tests) | ||
run: npm test | ||
|
||
############################################################################## | ||
# Markdownlint | ||
# | ||
test_markdownlint: | ||
runs-on: ubuntu-latest | ||
name: MarkdownLint | ||
steps: | ||
- name: Git checkout | ||
uses: actions/checkout@v4.1.1 | ||
- name: markdownlint-cli | ||
uses: nosborn/github-action-markdown-cli@v3.3.0 | ||
with: | ||
files: "*.md" | ||
config_file: ".markdownlint.yaml" | ||
|
||
############################################################################## | ||
# SonarCloud job | ||
# | ||
test_sonar: | ||
if: github.event_name != 'pull_request' | ||
needs: [ | ||
test_nodejs, | ||
test_markdownlint | ||
] | ||
runs-on: ubuntu-latest | ||
name: SonarCloud analyse | ||
steps: | ||
- name: Git checkout | ||
uses: actions/checkout@v4.1.1 | ||
with: | ||
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis | ||
- name: SonarCloud Scan | ||
uses: sonarsource/sonarcloud-github-action@master | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any | ||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | ||
with: | ||
args: > | ||
-Dsonar.verbose=true | ||
############################################################################## | ||
# Build application | ||
# | ||
build: | ||
if: github.ref == 'refs/heads/main' || ${{ startsWith(github.ref, 'refs/tags/v') }} | ||
needs: [ | ||
test_sonar | ||
] | ||
runs-on: ubuntu-latest | ||
name: Build and package | ||
steps: | ||
- name: Git checkout | ||
uses: actions/checkout@v4.1.1 | ||
- name: Use Node.js ${{ env.nodeLastVersion }} | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ env.nodeLastVersion }} | ||
- name: Install globally grunt-cli | ||
run: npm install -g grunt-cli | ||
- name: Install other dependencies | ||
run: npm install | ||
- name: Build .min.js file | ||
run: npm run build | ||
- name: Archive artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: lesshint-lint-xml-reporter-${{ github.sha }}.min.js | ||
path: dist/*.min.js | ||
- name: Package | ||
run: npm run release | ||
- name: Archive package | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: lesshint-lint-xml-reporter-${{ github.sha }}.tar.gz | ||
path: build/*.tar.gz | ||
|
||
############################################################################## | ||
# Release application | ||
# | ||
release: | ||
if: ${{ startsWith(github.ref, 'refs/tags/v') }} | ||
needs: build | ||
runs-on: ubuntu-latest | ||
name: Release on GitHub and NPM | ||
steps: | ||
- name: Git checkout | ||
uses: actions/checkout@v4.1.1 | ||
- name: Set env | ||
run: echo "RELEASE_VERSION=${GITHUB_REF:10}" >> $GITHUB_ENV | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- name: Install globally grunt-cli | ||
run: npm install -g grunt-cli | ||
- name: Install other dependencies | ||
run: npm install | ||
- name: Package | ||
run: npm run release | ||
- name: Create GitHub release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: ${{ github.ref }} | ||
release_name: Release ${{ github.ref }} | ||
body: | | ||
Changes in this Release | ||
- First Change | ||
- Second Change | ||
draft: true | ||
prerelease: false | ||
- name: Upload asset in GitHub release | ||
id: upload-release-asset | ||
uses: actions/upload-release-asset@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps | ||
asset_path: build/lesshint-lint-xml-reporter-${{ env.RELEASE_VERSION }}.tar.gz | ||
asset_name: lesshint-lint-xml-reporter-${{ env.RELEASE_VERSION }}.tar.gz | ||
asset_content_type: application/tar+gzip | ||
- name: Create NPM release | ||
uses: JS-DevTools/npm-publish@v3 | ||
with: | ||
token: ${{ secrets.NPM_TOKEN }} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.