-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
c3a97fb
commit 88374fc
Showing
5 changed files
with
120 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: Release module | ||
on: | ||
pull_request: | ||
workflow_dispatch: | ||
inputs: | ||
module_path: | ||
description: 'Path to the module to be released' | ||
required: true | ||
type: string | ||
|
||
|
||
#permissions: | ||
# issues: write | ||
# contents: write | ||
# pull-requests: write | ||
|
||
jobs: | ||
release-module: | ||
name: Release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: 'lts/*' | ||
- name: Install dependencies | ||
run: npm install | ||
- name: Release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: ./scripts/release.sh ${{ github.event.inputs.module_path }} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"name": "aptible_managed_endpoint", | ||
"description": "Managed HTTPS endpoint for Aptible." | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"name": "cfa-tofu-modules", | ||
"private": true, | ||
"repository": { | ||
"type": "git", | ||
"url": "[email protected]:codeforamerica/tofu-modules.git" | ||
}, | ||
"devDependencies": { | ||
"@semantic-release/github": "~11.0", | ||
"semantic-release": "~24.1" | ||
}, | ||
"release": { | ||
"branches": [ | ||
"main", | ||
"module-release" | ||
] | ||
}, | ||
"plugins": [ | ||
"@semantic-release/commit-analyzer", | ||
"@semantic-release/release-notes-generator", | ||
"@semantic-release/github" | ||
] | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#!/usr/bin/env bash | ||
|
||
ROOT_PATH="$(dirname "$0")/.." | ||
MODULE_PATH="$1" | ||
|
||
# Determine if a command exists on the current system. | ||
command_exists() { | ||
command -v "$1" >/dev/null 2>&1 | ||
} | ||
|
||
# Attempt to install the jq package. | ||
install_jq() { | ||
echo 'Attempting to install jq...' | ||
|
||
if command_exists brew; then | ||
brew install jq | ||
elif command_exists apt-get; then | ||
sudo apt-get install -y jq | ||
elif command_exists dnf; then | ||
sudo dnf install -y jq | ||
elif command_exists yum; then | ||
sudo yum install -y jq | ||
else | ||
echo 'error: unable to determine package manager' | ||
exit 1 | ||
fi | ||
} | ||
|
||
# Verify that jq is available on the system. | ||
if ! command_exists jq | ||
then | ||
install_jq | ||
fi | ||
|
||
# Combine the package.json files. | ||
jq -s ".[0] * .[1] | .repository.directory=\"${MODULE_PATH}\"" \ | ||
"${ROOT_PATH}/package.base.json" \ | ||
"${ROOT_PATH}/${MODULE_PATH}/package.module.json" \ | ||
> "${ROOT_PATH}/${MODULE_PATH}/package.json" | ||
|
||
module_name=$(jq -r '.name' "${ROOT_PATH}/${MODULE_PATH}/package.json") | ||
|
||
echo 'Installing dependencies...' | ||
cp LICENSE "${MODULE_PATH}/." | ||
cd "${MODULE_PATH}" | ||
npm install | ||
|
||
echo "Releasing module ${module_name}..." | ||
npx semantic-release -t "${module_name}/\${version}" | ||
|
||
echo 'Cleaning up...' | ||
#rm -rf package.json package-lock.json LICENSE node_modules |