-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #224 from bluewave-labs/staging-release-notes
Staging release notes
- Loading branch information
Showing
3 changed files
with
134 additions
and
55 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 |
---|---|---|
@@ -1,55 +1,55 @@ | ||
name: Deploy to Staging | ||
|
||
on: | ||
push: | ||
branches: | ||
- staging | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
node-version: [22.x] | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
|
||
- name: Set up SSH | ||
env: | ||
SSH_PRIVATE_KEY_NEW: ${{ secrets.SSH_THIRD_PRIVATE_KEY }} | ||
KNOWN_HOSTS: ${{ secrets.KNOWN_HOSTS }} | ||
run: | | ||
mkdir -p ~/.ssh | ||
echo "$SSH_PRIVATE_KEY_NEW" > ~/.ssh/id_rsa | ||
chmod 600 ~/.ssh/id_rsa | ||
eval $(ssh-agent -s) | ||
ssh-add ~/.ssh/id_rsa | ||
echo "$KNOWN_HOSTS" > ~/.ssh/known_hosts | ||
- name: Configure SSH for easier access | ||
run: | | ||
echo "Host staging-server" >> ~/.ssh/config | ||
echo " HostName ${{ secrets.DO_IP_ADDRESS }}" >> ~/.ssh/config | ||
echo " User ${{ secrets.DO_USERNAME }}" >> ~/.ssh/config | ||
echo " IdentityFile ~/.ssh/id_rsa" >> ~/.ssh/config | ||
echo " StrictHostKeyChecking no" >> ~/.ssh/config | ||
- name: Deploy to DigitalOcean Droplet | ||
run: | | ||
ssh -o StrictHostKeyChecking=no -t staging-server << 'EOF' | ||
set -e | ||
cd ~/bluewave-onboarding | ||
git stash | ||
git pull | ||
docker compose down | ||
docker compose build | ||
docker compose up -d | ||
EOF | ||
# name: Deploy to Staging | ||
|
||
# on: | ||
# push: | ||
# branches: | ||
# - staging | ||
|
||
# jobs: | ||
# deploy: | ||
# runs-on: ubuntu-latest | ||
# strategy: | ||
# matrix: | ||
# node-version: [22.x] | ||
|
||
# steps: | ||
# - name: Checkout code | ||
# uses: actions/checkout@v4 | ||
|
||
# - name: Set up Node.js ${{ matrix.node-version }} | ||
# uses: actions/setup-node@v4 | ||
# with: | ||
# node-version: ${{ matrix.node-version }} | ||
|
||
# - name: Set up SSH | ||
# env: | ||
# SSH_PRIVATE_KEY_NEW: ${{ secrets.SSH_THIRD_PRIVATE_KEY }} | ||
# KNOWN_HOSTS: ${{ secrets.KNOWN_HOSTS }} | ||
# run: | | ||
# mkdir -p ~/.ssh | ||
# echo "$SSH_PRIVATE_KEY_NEW" > ~/.ssh/id_rsa | ||
# chmod 600 ~/.ssh/id_rsa | ||
# eval $(ssh-agent -s) | ||
# ssh-add ~/.ssh/id_rsa | ||
# echo "$KNOWN_HOSTS" > ~/.ssh/known_hosts | ||
|
||
|
||
# - name: Configure SSH for easier access | ||
# run: | | ||
# echo "Host staging-server" >> ~/.ssh/config | ||
# echo " HostName ${{ secrets.DO_IP_ADDRESS }}" >> ~/.ssh/config | ||
# echo " User ${{ secrets.DO_USERNAME }}" >> ~/.ssh/config | ||
# echo " IdentityFile ~/.ssh/id_rsa" >> ~/.ssh/config | ||
# echo " StrictHostKeyChecking no" >> ~/.ssh/config | ||
|
||
# - name: Deploy to DigitalOcean Droplet | ||
# run: | | ||
# ssh -o StrictHostKeyChecking=no -t staging-server << 'EOF' | ||
# set -e | ||
# cd ~/bluewave-onboarding | ||
# git stash | ||
# git pull | ||
# docker compose down | ||
# docker compose build | ||
# docker compose up -d | ||
# EOF |
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,36 @@ | ||
name: Generate Release Notes | ||
|
||
on: | ||
push: | ||
branches: | ||
- staging | ||
|
||
jobs: | ||
generate_release_notes: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.x' | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install requests | ||
- name: Generate release notes | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: python generate_release_notes.py | ||
|
||
- name: Commit and push release notes | ||
run: | | ||
git config --local user.email "[email protected]" | ||
git config --local user.name "GitHub Action" | ||
git add release_notes.md | ||
git commit -m "Add release notes for the latest deployment" | ||
git push |
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,43 @@ | ||
import os | ||
import requests | ||
|
||
GITHUB_API_BASE_URL = "https://api.github.com" | ||
REPO_OWNER = "bluewave-labs" | ||
REPO_NAME = "bluewave-onboarding" | ||
GITHUB_TOKEN = os.getenv('GH_TOKEN') | ||
|
||
def get_issues(): | ||
url = f"{GITHUB_API_BASE_URL}/repos/{REPO_OWNER}/{REPO_NAME}/issues" | ||
headers = { | ||
'Authorization': f'token {GITHUB_TOKEN}', | ||
'Accept': 'application/vnd.github.v3+json', | ||
} | ||
params = { | ||
'state': 'closed', | ||
'filter': 'all', | ||
'per_page': 100 | ||
} | ||
|
||
response = requests.get(url, headers=headers, params=params) | ||
|
||
if response.status_code != 200: | ||
raise Exception(f"Error fetching issues: {response.status_code} {response.text}") | ||
|
||
return response.json() | ||
|
||
def generate_release_notes(): | ||
issues = get_issues() | ||
|
||
release_notes = "# Release Notes\n\n" | ||
|
||
for issue in issues: | ||
if 'pull_request' in issue and issue['pull_request'] is not None: | ||
if issue.get('merged_at'): | ||
release_notes += f"## {issue['title']}\n" | ||
release_notes += f"{issue['body']}\n\n" | ||
|
||
with open('release_notes.md', 'w') as f: | ||
f.write(release_notes) | ||
|
||
if __name__ == "__main__": | ||
generate_release_notes() |