Skip to content

Commit 572eb9d

Browse files
committed
Init workflows and base project
1 parent ddf1135 commit 572eb9d

25 files changed

+59667
-9
lines changed

.github/CODEOWNERS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# Give full ownership of all files in the repository to cfn-dev-productivity team
2+
* @aws-cloudformation/cfn-dev-productivity

.github/workflows/ci.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Build and Test
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
- beta
8+
- prod
9+
pull_request:
10+
branches:
11+
- main
12+
13+
jobs:
14+
get-versions:
15+
uses: ./.github/workflows/versions.yml
16+
17+
build-and-test:
18+
name: Build and Test
19+
needs: get-versions
20+
runs-on: ubuntu-latest
21+
22+
steps:
23+
- name: Checkout repository
24+
uses: actions/checkout@v4
25+
26+
- name: Setup Node.js
27+
uses: actions/setup-node@v4
28+
with:
29+
node-version: ${{ needs.get-versions.outputs.node-version }}
30+
cache: 'npm'
31+
32+
- name: Setup Go
33+
uses: actions/setup-go@v5
34+
with:
35+
go-version: ${{ needs.get-versions.outputs.go-version }}
36+
37+
- name: Install dependencies
38+
run: npm ci
39+
40+
- name: Lint application
41+
run: npm run lint
42+
43+
- name: Build application
44+
run: npm run build
45+
46+
- name: Run tests
47+
run: npm test
48+
49+
- name: Run tests (Go)
50+
run: npm run test:go
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Promote to Beta
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'Version to promote (e.g., 1.2.3)'
8+
required: true
9+
type: string
10+
11+
permissions:
12+
contents: write
13+
14+
jobs:
15+
get-versions:
16+
uses: ./.github/workflows/versions.yml
17+
18+
promote-to-beta:
19+
name: Promote Main to Beta
20+
needs: get-versions
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Checkout repository
24+
uses: actions/checkout@v4
25+
with:
26+
fetch-depth: 0
27+
token: ${{ secrets.GITHUB_TOKEN }}
28+
29+
- name: Setup Node.js
30+
uses: actions/setup-node@v4
31+
with:
32+
node-version: ${{ needs.get-versions.outputs.node-version }}
33+
34+
- name: Configure Git User
35+
run: |
36+
git config user.name "GitHub Actions"
37+
git config user.email "github-actions@github.com"
38+
39+
- name: Create version commit and tag on main branch
40+
run: |
41+
git checkout main
42+
git pull origin main
43+
npm version ${{ github.event.inputs.version }} -m "chore: Start release for v%s"
44+
git push origin main --follow-tags
45+
46+
- name: Merge main into beta
47+
run: |
48+
git checkout beta
49+
git pull origin beta
50+
git merge --no-ff -m "Release: Promoting main to beta for release v${{ github.event.inputs.version }}" main
51+
git push origin beta
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Promote to Prod
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
confirm_prod_promotion:
7+
description: 'Confirm promotion to PROD'
8+
required: true
9+
type: choice
10+
options:
11+
- 'No'
12+
- 'Yes'
13+
default: 'No'
14+
15+
permissions:
16+
contents: write
17+
18+
jobs:
19+
promote-to-prod:
20+
name: Promote Beta to Prod
21+
if: github.event.inputs.confirm_prod_promotion == 'Yes'
22+
runs-on: ubuntu-latest
23+
steps:
24+
- name: Checkout repository
25+
uses: actions/checkout@v4
26+
with:
27+
fetch-depth: 0
28+
token: ${{ secrets.GITHUB_TOKEN }}
29+
30+
- name: Configure Git User
31+
run: |
32+
git config user.name "GitHub Actions"
33+
git config user.email "github-actions@github.com"
34+
35+
- name: Merge beta into prod
36+
run: |
37+
git checkout beta
38+
git pull origin beta
39+
git checkout prod
40+
git pull origin prod
41+
git merge --no-ff -m "Release: Promoting beta to production" beta
42+
git push origin prod

.github/workflows/release.yml

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
name: Release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
branch:
7+
description: 'Branch to release from'
8+
required: true
9+
default: 'beta'
10+
type: choice
11+
options:
12+
- beta
13+
- prod
14+
15+
permissions:
16+
contents: write
17+
18+
jobs:
19+
get-versions:
20+
uses: ./.github/workflows/versions.yml
21+
22+
build-and-release:
23+
name: Build Release Assets
24+
needs: get-versions
25+
strategy:
26+
matrix:
27+
os: [ubuntu-latest, windows-latest, macos-latest, macos-12, ubuntu-20.04]
28+
arch: [x64, arm64]
29+
exclude:
30+
- os: windows-latest
31+
arch: arm64
32+
runs-on: ${{ matrix.os }}
33+
34+
steps:
35+
- name: Checkout repository
36+
uses: actions/checkout@v4
37+
38+
- name: Setup Node.js
39+
uses: actions/setup-node@v4
40+
with:
41+
node-version: ${{ needs.get-versions.outputs.node-version }}
42+
cache: 'npm'
43+
44+
# - name: Setup Go
45+
# uses: actions/setup-go@v5
46+
# with:
47+
# go-version: ${{ needs.get-versions.outputs.go-version }}
48+
49+
- name: Install Node.js dependencies
50+
run: npm ci
51+
52+
- name: Build Node.js application
53+
shell: bash
54+
run: |
55+
if [ "${{ github.event.inputs.branch }}" == "beta" ]; then
56+
npm run bundle:beta
57+
else
58+
npm run bundle:prod
59+
fi
60+
61+
# - name: Build Go application
62+
# run: npm run build:go:prod
63+
64+
- name: Read version from package.json
65+
id: get-version
66+
run: echo "version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT
67+
68+
- name: Set Release Asset Name
69+
id: set-asset-name
70+
shell: bash
71+
run: |
72+
APP_NAME='${{ needs.get-versions.outputs.app-name }}'
73+
VERSION=${{ steps.get-version.outputs.version }}
74+
OS=${{ matrix.os }}
75+
ARCH=${{ matrix.arch }}
76+
BRANCH=${{ github.event.inputs.branch }}
77+
78+
if [ "$BRANCH" = "beta" ]; then
79+
ASSET_NAME="${APP_NAME}-beta-${VERSION}-${OS}-${ARCH}.zip"
80+
else
81+
ASSET_NAME="${APP_NAME}-${VERSION}-${OS}-${ARCH}.zip"
82+
fi
83+
84+
echo "ASSET_NAME=$ASSET_NAME" >> $GITHUB_OUTPUT
85+
echo "ASSET_PATH=./$ASSET_NAME" >> $GITHUB_OUTPUT
86+
echo "ASSET_PATH=./$ASSET_NAME" >> $GITHUB_OUTPUT
87+
88+
- name: Create Zip Archive of the bundle
89+
shell: bash
90+
run: |
91+
zip -r ${{ steps.set-asset-name.outputs.ASSET_NAME }} bundle/production
92+
93+
- name: Create GitHub Release
94+
uses: softprops/action-gh-release@v2
95+
with:
96+
tag_name: v${{ steps.get-version.outputs.version }}
97+
name: Release v${{ steps.get-version.outputs.version }}${{ github.event.inputs.branch == 'beta' && ' (Beta)' || '' }}
98+
prerelease: ${{ github.event.inputs.branch == 'beta' }}
99+
files: ${{ steps.set-asset-name.outputs.ASSET_PATH }}
100+
fail_on_unmatched_files: true
101+
body: 'Release based on commit: ${{ github.sha }}'
102+
env:
103+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/versions.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Version Configuration
2+
3+
on:
4+
workflow_call:
5+
outputs:
6+
node-version:
7+
description: "Node.js version to use"
8+
value: ${{ jobs.versions.outputs.node-version }}
9+
go-version:
10+
description: "Go version to use"
11+
value: ${{ jobs.versions.outputs.go-version }}
12+
app-name:
13+
description: "Application name for releases"
14+
value: ${{ jobs.versions.outputs.app-name }}
15+
16+
jobs:
17+
versions:
18+
runs-on: ubuntu-latest
19+
outputs:
20+
node-version: ${{ steps.versions.outputs.node-version }}
21+
go-version: ${{ steps.versions.outputs.go-version }}
22+
app-name: ${{ steps.versions.outputs.app-name }}
23+
steps:
24+
- id: versions
25+
run: |
26+
echo "node-version=22.x" >> $GITHUB_OUTPUT
27+
echo "go-version=1.25.x" >> $GITHUB_OUTPUT
28+
echo "app-name=cloudformation-languageserver" >> $GITHUB_OUTPUT

.gitignore

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/node_modules
2+
/build
3+
/out
4+
/coverage
5+
/bundle
6+
/bin
7+
/tmp-node-modules
8+
*.tsbuildinfo
9+
*.node
10+
.DS_Store
11+
tools/*
12+
!tools/*.ts
13+
**/.aws-cfn-storage
14+
/oss-attribution

.prettierrc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"printWidth": 120,
3+
"tabWidth": 4,
4+
"singleQuote": true,
5+
"bracketSpacing": true
6+
}

ATTRIBUTION_README.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# NPM Attribution Guide
2+
3+
### 0. Install license tools (Only required once)
4+
5+
```bash
6+
brew install jq
7+
npm i -g oss-attribution-generator
8+
npm i -g license-checker
9+
```
10+
11+
### 1. Regenerate dependencies first
12+
13+
```bash
14+
npm run clean
15+
npm install
16+
```
17+
18+
### 2. Generate SBOM
19+
20+
```bash
21+
npm sbom --sbom-format spdx > sbom/sbom.json
22+
jq -r '["Name","SPDXID","Version","DownloadLocation","License"] as $header | $header, (.packages[] | select(.name != "@aws/cloudformation-languageserver") | [.name, .SPDXID, .versionInfo, .downloadLocation, .licenseDeclared]) | @csv' sbom/sbom.json > sbom/sbom.csv
23+
```
24+
25+
### 3. Generate Attribution Document
26+
27+
```bash
28+
generate-attribution
29+
cp oss-attribution/attribution.txt THIRD-PARTY-LICENSES.txt
30+
```
31+
32+
### Misc
33+
34+
#### Check licenses
35+
36+
```bash
37+
license-checker --production --exclude MIT,Apache-2.0,BSD-2-Clause,BSD-3-Clause,ISC,0BSD
38+
39+
npx license-checker --json | jq 'to_entries | group_by(.value.licenses) | map({key: .[0].value.licenses, value: map(.key)}) | from_entries'
40+
```

NOTICE

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,10 @@
1+
AWS CloudFormation Language Server
12
Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
4+
This product includes software developed at
5+
Amazon Web Services (https://aws.amazon.com/).
6+
7+
This software includes components licensed under various open source licenses.
8+
You can find a full list of third-party licenses in the THIRD-PARTY-LICENSES.txt file included with this distribution.
9+
10+
A complete Software Bill of Materials (SBOM) describing all components is available in sbom/spdx.json

0 commit comments

Comments
 (0)