Breath #50
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: Breath | |
on: | |
push: | |
schedule: | |
# Runs "at every start of month" (see https://crontab.guru) | |
- cron: "0 0 1 * *" | |
#- cron: "*/1 * * * *" # every 1 minutes | |
jobs: | |
generate-source: | |
name: Generate Source And Update Repo | |
permissions: write-all | |
runs-on: ubuntu-latest | |
if: github.event_name != 'push' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Generate Source Codes | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y wget apt-transport-https software-properties-common | |
wget -q "https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/packages-microsoft-prod.deb" | |
sudo dpkg -i packages-microsoft-prod.deb | |
sudo apt-get update | |
sudo apt-get install -y powershell nodejs npm | |
npm install -g json | |
pwsh -noprofile -executionpolicy bypass -file language-colors.ps1 | |
json -I -f "./nodejs/package.json" -e 'this.version="v2.${{ github.run_attempt }}.${{ github.run_number }}"'; | |
cp ./css/language-colors.css ./docs/ | |
cp ./vanillajs/language-colors.js ./docs/ | |
cp ./README.md ./nodejs/ | |
cat "./nodejs/package.json" | |
ls -l ./ | |
- name: Commit Generated Code | |
run: | | |
git config --global user.name 'A' | |
git config --global user.email 'iamthecarisma@gmail.com' | |
git commit -am "Breath for v2.${{ github.run_attempt }}.${{ github.run_number }}. Auto update from Github Action" | |
git push | |
# should push to main branch | |
run-tests: | |
name: Run Regression Tests | |
permissions: write-all | |
#needs: generate-source | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Run NodeJS Test | |
run: | | |
cd nodejs | |
npm install | |
npm test | |
deployment: | |
name: Deploy To Package Registries | |
permissions: write-all | |
runs-on: ubuntu-latest | |
needs: [generate-source, run-tests] | |
if: github.event_name != 'push' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v2 | |
- name: Changelog | |
uses: scottbrenner/generate-changelog-action@master | |
id: Changelog | |
env: | |
REPO: ${{ github.repository }} | |
- name: Build Node Package | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y nodejs npm | |
cd nodejs | |
npm pack | |
ls -l | |
# create github release | |
- uses: "marvinpinto/action-automatic-releases@latest" | |
with: | |
repo_token: "${{ secrets.GITHUB_TOKEN }}" | |
automatic_release_tag: "latest" | |
prerelease: false | |
title: "v2.${{ github.run_attempt }}.${{ github.run_number }}" | |
files: | | |
language-colors.ps1 | |
css/language-colors.css | |
vanillajs/language-colors.js | |
nodejs/language-colors-2.${{ github.run_attempt }}.${{ github.run_number }}.tgz | |
# create npm release | |
- uses: actions/setup-node@v1 | |
with: | |
registry-url: https://registry.npmjs.org/ | |
- name: Publish package to NPM 📦 | |
run: | | |
cd nodejs | |
npm publish --access public | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |