Skip to content

Commit 1ec096d

Browse files
committed
added workflows and scripts
1 parent 6e88515 commit 1ec096d

File tree

30 files changed

+10102
-38461
lines changed

30 files changed

+10102
-38461
lines changed

.github/config/release.json

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"releaseAll": true,
3+
"plugins": {
4+
"utilities": false,
5+
"command": false,
6+
"config": false,
7+
"auth": false,
8+
"export": false,
9+
"import": false,
10+
"clone": false,
11+
"export-to-csv": false,
12+
"migrate-rte": false,
13+
"migration": false,
14+
"seed": false,
15+
"bootstrap": false,
16+
"bulk-publish": false,
17+
"dev-dependencies": false,
18+
"launch": false,
19+
"branches": false,
20+
"core": false
21+
}
22+
}
Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# For most projects, this workflow file will not need changing; you simply need
2+
# to commit it to your repository.
3+
#
4+
# You may wish to alter this file to override the set of languages analyzed,
5+
# or to provide custom queries or build logic.
6+
#
7+
# ******** NOTE ********
8+
# We have attempted to detect the languages in your repository. Please check
9+
# the `language` matrix defined below to confirm you have the correct set of
10+
# supported CodeQL languages.
11+
#
12+
name: "CodeQL"
13+
14+
on:
15+
pull_request:
16+
# The branches below must be a subset of the branches above
17+
branches: '*'
18+
19+
jobs:
20+
analyze:
21+
name: Analyze
22+
runs-on: ubuntu-latest
23+
permissions:
24+
actions: read
25+
contents: read
26+
security-events: write
27+
28+
strategy:
29+
fail-fast: false
30+
matrix:
31+
language: [ 'javascript' ]
32+
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
33+
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
34+
35+
steps:
36+
- name: Checkout repository
37+
uses: actions/checkout@v3.5.3
38+
39+
# Initializes the CodeQL tools for scanning.
40+
- name: Initialize CodeQL
41+
uses: github/codeql-action/init@v2
42+
with:
43+
languages: ${{ matrix.language }}
44+
# If you wish to specify custom queries, you can do so here or in a config file.
45+
# By default, queries listed here will override any specified in a config file.
46+
# Prefix the list here with "+" to use these queries and those in the config file.
47+
48+
# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
49+
# queries: security-extended,security-and-quality
50+
51+
52+
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
53+
# If this step fails, then you should remove it and run the build manually (see below)
54+
- name: Autobuild
55+
uses: github/codeql-action/autobuild@v2
56+
57+
# ℹ️ Command-line programs to run using the OS shell.
58+
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
59+
60+
# If the Autobuild fails above, remove it and uncomment the following three lines.
61+
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
62+
63+
# - run: |
64+
# echo "Run, Build Application using script"
65+
# ./location_of_script_within_repo/buildscript.sh
66+
67+
- name: Perform CodeQL Analysis
68+
uses: github/codeql-action/analyze@v2

.github/workflows/issues-jira.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Create Jira Ticket for Github Issue
2+
3+
on:
4+
issues:
5+
types: [opened]
6+
7+
jobs:
8+
issue-jira:
9+
runs-on: ubuntu-latest
10+
steps:
11+
12+
- name: Login to Jira
13+
uses: atlassian/gajira-login@master
14+
env:
15+
JIRA_BASE_URL: ${{ secrets.JIRA_BASE_URL }}
16+
JIRA_USER_EMAIL: ${{ secrets.JIRA_USER_EMAIL }}
17+
JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }}
18+
19+
- name: Create Jira Issue
20+
id: create_jira
21+
uses: atlassian/gajira-create@master
22+
with:
23+
project: ${{ secrets.JIRA_PROJECT }}
24+
issuetype: ${{ secrets.JIRA_ISSUE_TYPE }}
25+
summary: Github | Issue | ${{ github.event.repository.name }} | ${{ github.event.issue.title }}
26+
description: |
27+
*GitHub Issue:* ${{ github.event.issue.html_url }}
28+
29+
*Description:*
30+
${{ github.event.issue.body }}
31+
fields: "${{ secrets.ISSUES_JIRA_FIELDS }}"

.github/workflows/policy-scan.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Checks the security policy and configurations
2+
on:
3+
pull_request:
4+
types: [opened, synchronize, reopened]
5+
jobs:
6+
security-policy:
7+
if: github.event.repository.visibility == 'public'
8+
runs-on: ubuntu-latest
9+
defaults:
10+
run:
11+
shell: bash
12+
steps:
13+
- uses: actions/checkout@master
14+
- name: Checks for SECURITY.md policy file
15+
run: |
16+
if ! [[ -f "SECURITY.md" || -f ".github/SECURITY.md" ]]; then exit 1; fi
17+
security-license:
18+
if: github.event.repository.visibility == 'public'
19+
runs-on: ubuntu-latest
20+
defaults:
21+
run:
22+
shell: bash
23+
steps:
24+
- uses: actions/checkout@master
25+
- name: Checks for License file
26+
run: |
27+
expected_license_files=("LICENSE" "LICENSE.txt" "LICENSE.md" "License.txt")
28+
license_file_found=false
29+
current_year=$(date +"%Y")
30+
31+
for license_file in "${expected_license_files[@]}"; do
32+
if [ -f "$license_file" ]; then
33+
license_file_found=true
34+
# check the license file for the current year, if not exists, exit with error
35+
if ! grep -q "$current_year" "$license_file"; then
36+
echo "License file $license_file does not contain the current year."
37+
exit 2
38+
fi
39+
break
40+
fi
41+
done
42+
43+
if [ "$license_file_found" = false ]; then
44+
echo "No license file found. Please add a license file to the repository."
45+
exit 1
46+
fi
Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
name: Release CLI Plugins (v1 Beta)
2+
3+
on:
4+
push:
5+
branches: [v1-beta]
6+
7+
jobs:
8+
build:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v4
12+
- uses: pnpm/action-setup@v4
13+
with:
14+
version: 7
15+
- uses: actions/setup-node@v4
16+
with:
17+
node-version: '22.x'
18+
19+
- name: Enable Corepack
20+
run: corepack enable
21+
22+
- name: Install pnpm
23+
run: corepack prepare pnpm@7 --activate
24+
25+
- name: Install root dependencies
26+
run: pnpm install
27+
28+
- name: Reading Configuration
29+
id: release_config
30+
uses: rgarcia-phi/json-to-variables@v1.1.0
31+
with:
32+
filename: .github/config/release.json
33+
prefix: release
34+
35+
# Dev Dependencies
36+
- name: Installing dependencies of dev dependencies
37+
id: dev-dependencies-installation
38+
if: ${{env.release_releaseAll == 'true' || env.release_plugins_dev-dependencies == 'true'}}
39+
working-directory: ./packages/contentstack-dev-dependencies
40+
run: npm install
41+
- name: Compiling dev dependencies
42+
if: ${{ steps.dev-dependencies-installation.conclusion == 'success' }}
43+
working-directory: ./packages/contentstack-dev-dependencies
44+
run: npm run prepack
45+
- name: Publishing dev dependencies (Beta)
46+
uses: JS-DevTools/npm-publish@v3
47+
if: ${{ steps.dev-dependencies-installation.conclusion == 'success' }}
48+
with:
49+
token: ${{ secrets.NPM_TOKEN }}
50+
package: ./packages/contentstack-dev-dependencies/package.json
51+
tag: beta
52+
53+
# Utilities
54+
- name: Installing dependencies of utilities
55+
id: utilities-installation
56+
if: ${{env.release_releaseAll == 'true' || env.release_plugins_utilities == 'true'}}
57+
working-directory: ./packages/contentstack-utilities
58+
run: npm install
59+
- name: Compiling utilities
60+
if: ${{ steps.utilities-installation.conclusion == 'success' }}
61+
working-directory: ./packages/contentstack-utilities
62+
run: npm run prepack
63+
- name: Publishing utilities (Beta)
64+
uses: JS-DevTools/npm-publish@v3
65+
if: ${{ steps.utilities-installation.conclusion == 'success' }}
66+
with:
67+
token: ${{ secrets.NPM_TOKEN }}
68+
package: ./packages/contentstack-utilities/package.json
69+
tag: beta
70+
71+
# Command
72+
- name: Installing dependencies of command
73+
id: command-installation
74+
if: ${{env.release_releaseAll == 'true' || env.release_plugins_command == 'true'}}
75+
working-directory: ./packages/contentstack-command
76+
run: npm install
77+
- name: Compiling command
78+
if: ${{ steps.command-installation.conclusion == 'success' }}
79+
working-directory: ./packages/contentstack-command
80+
run: npm run prepack
81+
- name: Publishing command (Beta)
82+
uses: JS-DevTools/npm-publish@v3
83+
if: ${{ steps.command-installation.conclusion == 'success' }}
84+
with:
85+
token: ${{ secrets.NPM_TOKEN }}
86+
package: ./packages/contentstack-command/package.json
87+
tag: beta
88+
89+
# Config
90+
- name: Installing dependencies of config
91+
id: config-installation
92+
if: ${{env.release_releaseAll == 'true' || env.release_plugins_config == 'true'}}
93+
working-directory: ./packages/contentstack-config
94+
run: npm install
95+
- name: Compiling config
96+
if: ${{ steps.config-installation.conclusion == 'success' }}
97+
working-directory: ./packages/contentstack-config
98+
run: npm run prepack
99+
- name: Publishing config (Beta)
100+
uses: JS-DevTools/npm-publish@v3
101+
if: ${{ steps.config-installation.conclusion == 'success' }}
102+
with:
103+
token: ${{ secrets.NPM_TOKEN }}
104+
package: ./packages/contentstack-config/package.json
105+
tag: beta
106+
107+
# Auth
108+
- name: Installing dependencies of auth
109+
id: auth-installation
110+
if: ${{env.release_releaseAll == 'true' || env.release_plugins_auth == 'true'}}
111+
working-directory: ./packages/contentstack-auth
112+
run: npm install
113+
- name: Compiling auth
114+
if: ${{ steps.auth-installation.conclusion == 'success' }}
115+
working-directory: ./packages/contentstack-auth
116+
run: npm run prepack
117+
- name: Publishing auth (Beta)
118+
uses: JS-DevTools/npm-publish@v3
119+
if: ${{ steps.auth-installation.conclusion == 'success' }}
120+
with:
121+
token: ${{ secrets.NPM_TOKEN }}
122+
package: ./packages/contentstack-auth/package.json
123+
tag: beta
124+
125+
- name: Create Platform Plugins Beta Release
126+
# Adjust the ID below to match your actual publishing step ID for plugins
127+
if: ${{ steps.publish-plugins.conclusion == 'success' }}
128+
id: create_release_plugins
129+
env:
130+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
131+
# Extract version from the output of your plugin publish step
132+
VERSION: ${{ steps.publish-plugins.outputs.version }}
133+
run: |
134+
# Look for the last release specifically starting with 'plugins@v'
135+
PREVIOUS_BETA=$(gh release list --limit 50 | grep 'platform-plugins@v' | grep 'beta' | head -1 | cut -f1)
136+
137+
if [ -n "$PREVIOUS_BETA" ]; then
138+
gh release create "platform-plugins@v$VERSION" --title "Platform Plugins Beta $VERSION" --notes-from-tag "$PREVIOUS_BETA" --prerelease
139+
else
140+
gh release create "platform-plugins@v$VERSION" --title "Platform Plugins Beta $VERSION" --generate-notes --prerelease
141+
fi

0 commit comments

Comments
 (0)