Skip to content

feat(build-tools): Added back cjs build and local package.json depend… #2526

feat(build-tools): Added back cjs build and local package.json depend…

feat(build-tools): Added back cjs build and local package.json depend… #2526

Workflow file for this run

# Note: this pipelines is for the `storm-ops` repository, it should be used to build and release the Storm Nx-Plugin packages.
name: "CI/CD"
on:
workflow_dispatch:
inputs:
tag:
description: override release tag
required: false
push:
branches:
- "main"
- "next"
- "experimental"
- "beta"
env:
CI: true
# NX_CLOUD_DISTRIBUTED_EXECUTION: true # this enables DTE
# NX_CLOUD_DISTRIBUTED_EXECUTION_AGENT_COUNT: 3 # expected number of agents
# NX_BRANCH: ${{ github.event.number || github.ref_name }}
# NX_CLOUD_ACCESS_TOKEN: ${{ secrets.NX_CLOUD_ACCESS_TOKEN }}
STORM_BOT: Stormie-Bot
STORM_REPOSITORY: ${{ github.repositoryUrl }}
STORM_WORKSPACE_ROOT: ${{ github.workspace }}
GITHUB_ACTOR: ${{ github.actor }}
GITHUB_TOKEN: ${{ github.token }}
NPM_TOKEN: ${{ secrets.STORM_BOT_NPM_TOKEN }}
CARGO_REGISTRY_TOKEN: ${{ secrets.STORM_BOT_CARGO_TOKEN }}
jobs:
release:
if: github.repository == 'storm-software/storm-ops' && (github.ref ==
'refs/heads/main' || github.ref == 'refs/heads/next' || github.ref ==
'refs/heads/beta' || github.ref == 'refs/heads/experimental')
name: "Continuous Integration"
runs-on: ubuntu-latest
permissions:
actions: read
contents: write
id-token: write
steps:
- name: Send Slack notification - Deployment started
uses: slackapi/[email protected]
with:
channel-id: "notifications"
payload: |
{
"text": "Deployment for ${{ github.repository }} has started (In Progress)",
"attachments": [
{
"pretext": "Deployment for ${{ github.repository }} has started",
"color": "1fb2a6",
"fields": [
{
"title": "Status",
"short": true,
"value": "In Progress"
}
]
}
]
}
env:
SLACK_BOT_TOKEN: ${{ secrets.STORM_BOT_SLACK_TOKEN }}
- name: Send Discord notification - Deployment started
uses: Ilshidur/action-discord@master
with:
args: "Deployment for ${{ github.repository }} has started - #${{
github.run_number }}"
env:
DISCORD_WEBHOOK: ${{ secrets.STORM_BOT_DISCORD_WEBHOOK }}
DISCORD_USERNAME: ${{ env.STORM_BOT }}
DISCORD_AVATAR: "https://pub-761b436209f44a4d886487c917806c08.r2.dev/icon-stormie.png"
DISCORD_EMBEDS:
'[{"title": "Deployment #${{ github.run_number }} has started",
"description": "Deployment for ${{ github.repository }} is currently
in process - #${{ github.run_number }}", "thumbnail": { "url":
"https://pub-761b436209f44a4d886487c917806c08.r2.dev/icon-fill.png"
}, "image": { "url":
"https://pub-761b436209f44a4d886487c917806c08.r2.dev/logo-fill.png"
}, "author": { "name": "${{ github.actor }}", "url":
"https://github.com/${{ github.actor }}", "icon_url":
"https://avatars.githubusercontent.com/u/${{ github.actor_id }}?v=4"
}, "fields": [ { "name": "Repository", "value": "${{
github.repository }}" }, { "name": "Repository URL", "value": "${{
github.repositoryUrl }}" }, { "name": "Pipeline Status", "value":
"In Progress" }], "color": 2077350, "timestamp": "${{
github.event.repository.updated_at }}", "url": "${{
github.event.pull_request.html_url || github.event.head_commit.url
}}", "footer": { "text": "Click here to see the full workflow
details: ${{ github.event.pull_request.html_url ||
github.event.head_commit.url }}", "icon_url":
"https://pub-761b436209f44a4d886487c917806c08.r2.dev/icon-fill.png"
} }]'
- name: Send Telegram notification - Deployment started
uses: storm-software/action-telegram-notify@main
with:
status: "in-progress"
env:
TELEGRAM_TOKEN: ${{ secrets.STORM_BOT_TELEGRAM_TOKEN }}
TELEGRAM_CHAT: ${{ secrets.STORM_BOT_TELEGRAM_NOTIFICATION_CHAT }}
- name: Setup workspace
uses: storm-software/action-setup@main
with:
package-manager: pnpm
package-manager-version: 9.10.0
storm-bot: ${{ env.STORM_BOT }}
storm-bot-github-token: ${{ secrets.STORM_BOT_GITHUB_TOKEN }}
- name: Build Storm Nx-Plugin packages
run: pnpm build-plugins
shell: bash
- uses: nrwl/nx-set-shas@v4
with:
main-branch-name: main
# - run: pnpm exec nx-cloud record -- nx format:write
# - run: pnpm nx affected -t build --parallel=5
# - name: Run commands in parallel
# run: |
# # initialize an array to store process IDs (PIDs)
# pids=()
# # function to run commands and store the PID
# function run_command() {
# local command=$1
# $command & # run the command in the background
# pids+=($!) # store the PID of the background process
# }
# # list of commands to be run on main has env flag NX_CLOUD_DISTRIBUTED_EXECUTION set to false
# run_command "NX_CLOUD_DISTRIBUTED_EXECUTION=false pnpm exec nx-cloud record -- nx format:check"
# # list of commands to be run on agents
# run_command "pnpm nx affected -t lint,format,build --parallel=5"
# # wait for all background processes to finish
# for pid in ${pids[*]}; do
# if ! wait $pid; then
# exit 1 # exit with an error status if any process fails
# fi
# done
# exit 0 # exits with success status if a all processes complete successfully
# - name: Get appropriate base and head commits for `nx affected` commands
# uses: nrwl/nx-set-shas@v4
# if: ${{ github.event_name == 'pull_request' }}
# with:
# main-branch-name: "main"
# - name: Set appropriate base and head commits for `nx affected` commands
# run: |
# echo "BASE: ${{ env.NX_BASE }}"
# echo "HEAD: ${{ env.NX_HEAD }}"
# shell: bash
- name: Run build script
run: pnpm build-all
shell: bash
# - name: Run formatters scripts
# run: pnpm nx affected -t lint,format,build --parallel=5
# shell: bash
- name: Add permissions to linting tools
run: chmod a=rwx dist/packages/linting-tools/bin/lint.js
- name: Add permissions to alex config file
run: chmod a=rwx dist/packages/linting-tools/alex/.alexrc
- name: Add permissions to alex ignore file
run: chmod a=rwx dist/packages/linting-tools/alex/.alexignore
- name: Add permissions to linting-tools package.json file
run: chmod a=rwx packages/linting-tools/package.json
- name: Add permissions to git-tools package.json file
run: chmod a=rwx packages/git-tools/package.json
- name: Add permissions to workspace-tools package.json file
run: chmod a=rwx packages/workspace-tools/package.json
- name: Add permissions to create-storm-workspace package.json file
run: chmod a=rwx packages/create-storm-workspace/package.json
- name: Add permissions to linting-tools distribution package.json file
run: chmod a=rwx dist/packages/linting-tools/package.json
- name: Add permissions to git-tools distribution package.json file
run: chmod a=rwx dist/packages/git-tools/package.json
- name: Add permissions to workspace-tools distribution package.json file
run: chmod a=rwx dist/packages/workspace-tools/package.json
- name:
Add permissions to create-storm-workspace distribution package.json
file
run: chmod a=rwx dist/packages/create-storm-workspace/package.json
# - name: Build repository packages
# run: pnpm nx affected -t build --parallel=5
- name: Add permissions to git tools
run: chmod a=rwx dist/packages/git-tools/bin/git.js
- name: Release Library Version Updates
run: pnpm release --base=${{ env.NX_BASE }} --head=${{ env.NX_HEAD }}
env:
GITHUB_ACTOR: ${{ github.actor }}
GITHUB_TOKEN: ${{ github.token }}
GH_TOKEN: ${{ github.token }}
NPM_TOKEN: ${{ secrets.STORM_BOT_NPM_TOKEN }}
CARGO_REGISTRY_TOKEN: ${{ secrets.STORM_BOT_CARGO_TOKEN }}
STORM_BOT: Stormie-Bot
STORM_WORKSPACE_ROOT: ${{ github.workspace }}
STORM_REPOSITORY: ${{ github.repositoryUrl }}
TAG: ${{ inputs.tag }}
success:
needs:
- release
if: ${{ success() }}
name: Send success notification
runs-on: ubuntu-latest
steps:
- name: Send Slack notification - Deployment successful
uses: slackapi/[email protected]
with:
channel-id: "notifications"
update-ts: ${{ steps.release.outputs.ts }}
payload: |
{
"text": "Deployment for ${{ github.repository }} has finished (Completed) \n\nPipeline Status: Success \nClick here to see the full workflow details: ${{ github.event.pull_request.html_url || github.event.head_commit.url }}",
"attachments": [
{
"pretext": "Deployment for ${{ github.repository }} has finished successfully",
"color": "087f5b",
"fields": [
{
"title": "Status",
"short": true,
"value": "Completed"
}
]
}
]
}
env:
SLACK_BOT_TOKEN: ${{ secrets.STORM_BOT_SLACK_TOKEN }}
- name: Send Discord notification - Deployment successful
uses: Ilshidur/action-discord@master
with:
args: "Deployment for ${{ github.repository }} finished successfully -
#${{ github.run_number }}"
env:
DISCORD_WEBHOOK: ${{ secrets.STORM_BOT_DISCORD_WEBHOOK }}
DISCORD_USERNAME: ${{ env.STORM_BOT }}
DISCORD_AVATAR: "https://pub-761b436209f44a4d886487c917806c08.r2.dev/icon-stormie.png"
DISCORD_EMBEDS:
'[{"title": "Deployment #${{ github.run_number }} was successful!",
"description": "Deployment for ${{ github.repository }} has finished
successfully - #${{ github.run_number }}", "thumbnail": { "url":
"https://pub-761b436209f44a4d886487c917806c08.r2.dev/icon-fill.png"
}, "image": { "url":
"https://pub-761b436209f44a4d886487c917806c08.r2.dev/logo-fill.png"
}, "author": { "name": "${{ github.actor }}", "url":
"https://github.com/${{ github.actor }}", "icon_url":
"https://avatars.githubusercontent.com/u/${{ github.actor_id }}?v=4"
}, "fields": [ { "name": "Repository", "value": "${{
github.repository }}" }, { "name": "Repository URL", "value": "${{
github.repositoryUrl }}" }, { "name": "Pipeline Status", "value":
"Success" }], "color": 556891, "timestamp": "${{
github.event.repository.updated_at }}", "url": "${{
github.event.pull_request.html_url || github.event.head_commit.url
}}", "footer": { "text": "Click here to see the full workflow
details: ${{ github.event.pull_request.html_url ||
github.event.head_commit.url }}", "icon_url":
"https://pub-761b436209f44a4d886487c917806c08.r2.dev/icon-fill.png"
}}]'
- name: Send Telegram notification - Deployment successful
uses: storm-software/action-telegram-notify@main
with:
status: "success"
env:
TELEGRAM_TOKEN: ${{ secrets.STORM_BOT_TELEGRAM_TOKEN }}
TELEGRAM_CHAT: ${{ secrets.STORM_BOT_TELEGRAM_NOTIFICATION_CHAT }}
failure:
needs:
- release
if: ${{ failure() }}
name: Send failure notification
runs-on: ubuntu-latest
steps:
- name: Send Slack notification - Deployment failed
uses: slackapi/[email protected]
with:
channel-id: "notifications"
update-ts: ${{ steps.release.outputs.ts }}
payload: |
{
"text": "Deployment for ${{ github.repository }} has finished (Failure) \n\nPipeline Status: Failure\nError: ${{ job.conclusion }}\nReason: ${{ job.cancelled }}\nConclusion: ${{ job.conclusion }}\nOutput: ${{ job.output }}\nLogs: ${{ job.logs }} \nSteps: ${{ job.steps }} \nActions: ${{ job.actions }} \nServices: ${{ job.services }} \nEnvironment: ${{ job.environment}} \nClick here to see the full workflow details: ${{ github.event.pull_request.html_url || github.event.head_commit.url }}",
"attachments": [
{
"pretext": "Deployment for ${{ github.repository }} has finished with failures",
"color": "990000",
"fields": [
{
"title": "Status",
"short": true,
"value": "Failure"
}
]
}
]
}
env:
SLACK_BOT_TOKEN: ${{ secrets.STORM_BOT_SLACK_TOKEN }}
- name: Send Discord notification - Deployment failed
uses: Ilshidur/action-discord@master
with:
args:
"Deployment for ${{ github.repository }} finished with failures -
#${{ github.run_number }}"
env:
DISCORD_WEBHOOK: ${{ secrets.STORM_BOT_DISCORD_WEBHOOK }}
DISCORD_USERNAME: ${{ env.STORM_BOT }}
DISCORD_AVATAR: "https://pub-761b436209f44a4d886487c917806c08.r2.dev/icon-stormie.png"
DISCORD_EMBEDS:
'[{"title": "Deployment #${{ github.run_number }} has failed",
"description": "Deployment for ${{ github.repository }} finished
with failures - #${{ github.run_number }}", "thumbnail": { "url":
"https://pub-761b436209f44a4d886487c917806c08.r2.dev/icon-fill.png"
}, "image": { "url":
"https://pub-761b436209f44a4d886487c917806c08.r2.dev/logo-fill.png"
}, "author": { "name": "${{ github.actor }}", "url":
"https://github.com/${{ github.actor }}", "icon_url":
"https://avatars.githubusercontent.com/u/${{ github.actor_id }}?v=4"
}, "fields": [ { "name": "Repository", "value": "${{
github.repository }}" }, { "name": "Repository URL", "value": "${{
github.repositoryUrl }}" }, { "name": "Pipeline Status", "value":
"Failure" }, { "name": "Event", "value": "${{ github.event_name }}"
}, { "name": "Result", "value": "${{ steps.release.result }}" }, {
"name": "Conclusion", "value": "${{ steps.release.conclusion }}" },
{ "name": "Output", "value": "${{ toJSON(steps.release.outputs) }}"
}], "color": 10027008, "timestamp": "${{
github.event.repository.updated_at }}", "url": "${{
github.event.pull_request.html_url || github.event.head_commit.url
}}", "footer": { "text": "Click here to see the full workflow
details: ${{ github.event.pull_request.html_url ||
github.event.head_commit.url }}", "icon_url":
"https://pub-761b436209f44a4d886487c917806c08.r2.dev/icon-fill.png"
} }]'
- name: Send Telegram notification - Deployment failed
uses: storm-software/action-telegram-notify@main
with:
status: "failed"
env:
TELEGRAM_TOKEN: ${{ secrets.STORM_BOT_TELEGRAM_TOKEN }}
TELEGRAM_CHAT: ${{ secrets.STORM_BOT_TELEGRAM_NOTIFICATION_CHAT }}
cancelled:
needs:
- release
if: ${{ cancelled() }}
name: Send cancelled notification
runs-on: ubuntu-latest
steps:
- name: Send Slack notification - Deployment cancelled
uses: slackapi/[email protected]
with:
channel-id: "notifications"
update-ts: ${{ steps.release.outputs.ts }}
payload: |
{
"text": "Deployment for ${{ github.repository }} has finished (Cancelled) \n\nPipeline Status: Cancelled\nError: ${{ job.conclusion }}\nReason: ${{ job.cancelled }}\nConclusion: ${{ job.conclusion }}\nOutput: ${{ job.output }}\nLogs: ${{ job.logs }} \nSteps: ${{ job.steps }} \nActions: ${{ job.actions }} \nServices: ${{ job.services }} \nEnvironment: ${{ job.environment}} \nClick here to see the full workflow details: ${{ github.event.pull_request.html_url || github.event.head_commit.url }}",
"attachments": [
{
"pretext": "Deployment for ${{ github.repository }} has been cancelled",
"color": "990000",
"fields": [
{
"title": "Status",
"short": true,
"value": "Cancelled"
}
]
}
]
}
env:
SLACK_BOT_TOKEN: ${{ secrets.STORM_BOT_SLACK_TOKEN }}
- name: Send Discord notification - Deployment cancelled
uses: Ilshidur/action-discord@master
with:
args:
"Deployment for ${{ github.repository }} has been cancelled - #${{
github.run_number }}"
env:
DISCORD_WEBHOOK: ${{ secrets.STORM_BOT_DISCORD_WEBHOOK }}
DISCORD_USERNAME: ${{ env.STORM_BOT }}
DISCORD_AVATAR: "https://pub-761b436209f44a4d886487c917806c08.r2.dev/icon-stormie.png"
DISCORD_EMBEDS:
'[{"title": "Deployment #${{ github.run_number }} was cancelled",
"description": "Deployment for ${{ github.repository }} was
cancelled before it could complete normal execution - #${{
github.run_number }}", "thumbnail": { "url":
"https://pub-761b436209f44a4d886487c917806c08.r2.dev/icon-fill.png"
}, "image": { "url":
"https://pub-761b436209f44a4d886487c917806c08.r2.dev/logo-fill.png"
}, "author": { "name": "${{ github.actor }}", "url":
"https://github.com/${{ github.actor }}", "icon_url":
"https://avatars.githubusercontent.com/u/${{ github.actor_id }}?v=4"
}, "fields": [ { "name": "Repository", "value": "${{
github.repository }}" }, { "name": "Repository URL", "value": "${{
github.repositoryUrl }}" }, { "name": "Pipeline Status", "value":
"Cancelled" }, { "name": "Event", "value": "${{ github.event_name
}}" }, { "name": "Result", "value": "${{ steps.release.result }}" },
{ "name": "Conclusion", "value": "${{ steps.release.conclusion }}"
}, { "name": "Output", "value": "${{ toJSON(steps.release.outputs)
}}" }], "color": 16565273, "timestamp": "${{
github.event.repository.updated_at }}", "url": "${{
github.event.pull_request.html_url || github.event.head_commit.url
}}", "footer": { "text": "Click here to see the full workflow
details: ${{ github.event.pull_request.html_url ||
github.event.head_commit.url }}", "icon_url":
"https://pub-761b436209f44a4d886487c917806c08.r2.dev/icon-fill.png"
} }]'
- name: Send Telegram notification - Deployment cancelled
uses: storm-software/action-telegram-notify@main
with:
status: "cancelled"
env:
TELEGRAM_TOKEN: ${{ secrets.STORM_BOT_TELEGRAM_TOKEN }}
TELEGRAM_CHAT: ${{ secrets.STORM_BOT_TELEGRAM_NOTIFICATION_CHAT }}