Merge pull request #24 from HoseaCodes/fix/article #86
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
name: Dev Pipeline | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- v* | |
jobs: | |
static-scan: | |
runs-on: ubuntu-latest | |
env: | |
JSON_OUTPUT: snyk-static-scan.json | |
steps: | |
- uses: actions/checkout@master | |
- uses: snyk/actions/setup@master | |
- uses: actions/setup-go@v1 | |
- name: Run Snyk to check for vulnerabilities | |
continue-on-error: true | |
run: | | |
snyk code test | |
snyk-to-html -i $JSON_OUTPUT -o snyk.html | |
env: | |
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }} | |
- name: Archive snyk results | |
uses: actions/upload-artifact@v3 | |
with: | |
name: snyk-report | |
path: output/scan/snyk.html | |
retention-days: 5 | |
dependency-scan: | |
runs-on: ubuntu-latest | |
env: | |
JSON_OUTPUT: snyk-dependency-scan.json | |
steps: | |
- uses: actions/checkout@master | |
- uses: snyk/actions/setup@master | |
- uses: actions/setup-go@v1 | |
- name: Run Snyk to check for vulnerabilities | |
continue-on-error: true | |
run: | | |
snyk test | |
snyk-to-html -i $JSON_OUTPUT -o snyk.html | |
env: | |
SNYK_TOKEN: ${{ secrets.SNYK_TOKEN }} | |
- name: Archive snyk results | |
uses: actions/upload-artifact@v3 | |
with: | |
name: snyk-report | |
path: output/scan/snyk.html | |
retention-days: 5 | |
lint: | |
needs: [static-scan, dependency-scan] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- run: npm i --legacy-peer-deps | |
- name: lint | |
continue-on-error: true | |
run: npm run lint | |
build: | |
needs: [static-scan, dependency-scan, lint] | |
runs-on: ubuntu-latest | |
outputs: | |
build_path: ${{ steps.archive_build.outputs.build_path }} | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v2 | |
- name: Set up Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '20' | |
- name: Install Dependencies | |
run: npm install --legacy-peer-deps | |
- name: Build project | |
run: | | |
export SKIP_PREFLIGHT_CHECK=true | |
npm run build | |
- name: Archive build output | |
id: archive_build | |
run: | | |
tar -czf build.tar.gz build/ | |
echo "::set-output name=build_path::build.tar.gz" | |
- name: Create conventional changelog action | |
id: changelog | |
uses: TriPSs/conventional-changelog-action@latest | |
with: | |
github-token: "${{ secrets.GITHUB_TOKEN }}" | |
tag-prefix: "dev.v" | |
git-push: false | |
- name: Create GitHub Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ steps.changelog.outputs.tag }} | |
release_name: Release ${{ steps.changelog.outputs.tag }} | |
body: ${{steps.changelog.outputs.clean_changelog}} | |
draft: false | |
prerelease: false | |
- name: Upload Release Asset | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: build.tar.gz | |
asset_name: build.tar.gz | |
asset_content_type: application/gzip | |
- name: Deploy to Heroku | |
uses: akhileshns/[email protected] | |
with: | |
heroku_api_key: ${{ secrets.HEROKU_API_KEY }} | |
heroku_app_name: hoseacodes-dev | |
heroku_email: "[email protected]" |