-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated board release workflow for test purposes #15
- Loading branch information
1 parent
2de16b9
commit 7f66e82
Showing
1 changed file
with
86 additions
and
88 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 |
---|---|---|
|
@@ -28,11 +28,12 @@ jobs: | |
uses: actions/checkout@v4 | ||
with: | ||
ref: ${{ github.event.inputs.release_branch }} # Dynamically using the branch input | ||
token: ${{ steps.app-token.outputs.token }} | ||
|
||
- name: Set up Git | ||
- name: Add GitHub Actions credentials | ||
run: | | ||
git config user.name "github-actions" | ||
git config user.email "[email protected]" | ||
git config user.name github-actions | ||
git config user.email [email protected] | ||
- name: Fetch Master Branch | ||
run: git fetch origin master | ||
|
@@ -53,95 +54,92 @@ jobs: | |
echo "$PR_RESPONSE" > pr_response.json | ||
PR_NUMBER=$(jq '.number' pr_response.json) | ||
echo "PR NUMBER IS: ${PR_NUMBER}" | ||
echo $PR_RESPONSE | ||
rm pr_response.json | ||
echo "Pull request number is $PR_NUMBER" | ||
echo "pull_request_number=$PR_NUMBER" >> $GITHUB_OUTPUT | ||
# Automatically approve PR | ||
- name: Approve Pull Request | ||
run: | | ||
echo "PR NUMBER IS: ${{ steps.create_pr.outputs.pull_request_number }}" | ||
# curl -X POST \ | ||
# -H "Authorization: token ${{ secrets.MIKROE_ACTIONS_KEY }}" \ | ||
# -H "Accept: application/vnd.github+json" \ | ||
# https://api.github.com/repos/${{ github.repository }}/pulls/${{ steps.create_pr.outputs.pull_request_number }}/reviews \ | ||
# -d '{"event":"APPROVE"}' | ||
|
||
# # Automatically merge the pull request using the GitHub API | ||
# - name: Automatically Merge Pull Request | ||
# run: | | ||
# PR_NUMBER=${{ steps.create_pr.outputs.pull_request_number }} | ||
# curl -s -X PUT \ | ||
# -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ | ||
# -H "Accept: application/vnd.github+json" \ | ||
# https://api.github.com/repos/${{ github.repository }}/pulls/$PR_NUMBER/merge \ | ||
# -d "{\"commit_title\":\"Auto-merged PR from ${{ github.event.inputs.release_branch }} to master\",\"merge_method\":\"squash\"}" | ||
|
||
# - name: Handle Merge Conflict | ||
# if: failure() | ||
# run: echo "::error::Merge conflict occurred. Please resolve manually." | ||
|
||
# - name: Checkout to master | ||
# run: | | ||
# git fetch origin | ||
# git checkout master | ||
# git pull origin master | ||
|
||
# - name: Set up Python | ||
# uses: actions/setup-python@v5 | ||
# with: | ||
# python-version: '3.x' | ||
|
||
# - name: Install Dependencies | ||
# run: | | ||
# python -m pip install --upgrade pip | ||
# pip install aiohttp | ||
# pip install aiofiles | ||
# pip install requests | ||
# pip install py7zr | ||
# pip install chardet | ||
# pip install elasticsearch==7.13.4 | ||
# pip install packaging | ||
# sudo apt-get install p7zip-full | ||
|
||
# - name: Update Changelogs | ||
# run: | | ||
# python -u scripts/update_board_changelog.py | ||
# python -u scripts/log_changes.py | ||
|
||
# - name: Commit Changelog to master | ||
# run: | | ||
# echo "Updating with new changelog files"; | ||
# git add changelog/** | ||
# git commit -m "Updated changelog files with latest merged release." | ||
# git push | ||
|
||
# - name: Upload Board Asset | ||
# run: python -u scripts/package.py ${{ secrets.GITHUB_TOKEN }} ${{ github.repository }} ${{ github.event.release.tag_name }} "True" | ||
|
||
# - name: Run Index Script | ||
# env: | ||
# ES_HOST: ${{ secrets.ES_HOST }} | ||
# ES_USER: ${{ secrets.ES_USER }} | ||
# ES_PASSWORD: ${{ secrets.ES_PASSWORD }} | ||
# MIKROE_NECTO_AWS: ${{ secrets.MIKROE_NECTO_AWS }} | ||
# run: | | ||
# echo "Indexing to Test." | ||
# python -u scripts/index.py ${{ github.repository }} ${{ secrets.GITHUB_TOKEN }} ${{ github.event.inputs.release_version }} ${{ secrets.ES_INDEX_TEST }} | ||
|
||
# - name: Trigger database update in Core repo | ||
# run: | | ||
# # Set the required variables | ||
# repo_owner="MikroElektronika" | ||
# repo_name="core_packages" | ||
# event_type="trigger-workflow" | ||
# version="${{ github.event.inputs.release_version }}" | ||
|
||
# curl -L \ | ||
# -X POST \ | ||
# -H "Accept: application/vnd.github+json" \ | ||
# -H "Authorization: Bearer ${{ secrets.MIKROE_ACTIONS_KEY }}" \ | ||
# -H "X-GitHub-Api-Version: 2022-11-28" \ | ||
# https://api.github.com/repos/$repo_owner/$repo_name/dispatches \ | ||
# -d "{\"event_type\": \"$event_type\", \"client_payload\": {\"version\": \"$version\", \"index\": \"Test\", \"unit\": false, \"integration\": true}}" | ||
curl -X POST \ | ||
-H "Authorization: token ${{ secrets.MIKROE_ACTIONS_KEY }}" \ | ||
-H "Accept: application/vnd.github+json" \ | ||
https://api.github.com/repos/${{ github.repository }}/pulls/${{ steps.create_pr.outputs.pull_request_number }}/reviews \ | ||
-d '{"event":"APPROVE"}' | ||
# Automatically merge the pull request using the GitHub API | ||
- name: Automatically Merge Pull Request | ||
run: | | ||
curl -s -X PUT \ | ||
-H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ | ||
-H "Accept: application/vnd.github+json" \ | ||
https://api.github.com/repos/${{ github.repository }}/pulls/${{ steps.create_pr.outputs.pull_request_number }}/merge \ | ||
-d "{\"commit_title\":\"Auto-merged PR from ${{ github.event.inputs.release_branch }} to master\",\"merge_method\":\"squash\"}" | ||
- name: Handle Merge Conflict | ||
if: failure() | ||
run: echo "::error::Merge conflict occurred. Please resolve manually." | ||
|
||
- name: Checkout to master | ||
run: | | ||
git fetch origin | ||
git checkout master | ||
git pull origin master | ||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.x' | ||
|
||
- name: Install Dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install aiohttp | ||
pip install aiofiles | ||
pip install requests | ||
pip install py7zr | ||
pip install chardet | ||
pip install elasticsearch==7.13.4 | ||
pip install packaging | ||
sudo apt-get install p7zip-full | ||
- name: Update Changelogs | ||
run: | | ||
python -u scripts/update_board_changelog.py | ||
python -u scripts/log_changes.py | ||
- name: Commit Changelog to master | ||
run: | | ||
echo "Updating with new changelog files"; | ||
git add changelog/** | ||
git commit -m "Updated changelog files with latest merged release." | ||
git push | ||
- name: Upload Board Asset | ||
run: python -u scripts/package.py ${{ secrets.GITHUB_TOKEN }} ${{ github.repository }} ${{ github.event.release.tag_name }} "True" | ||
|
||
- name: Run Index Script | ||
env: | ||
ES_HOST: ${{ secrets.ES_HOST }} | ||
ES_USER: ${{ secrets.ES_USER }} | ||
ES_PASSWORD: ${{ secrets.ES_PASSWORD }} | ||
MIKROE_NECTO_AWS: ${{ secrets.MIKROE_NECTO_AWS }} | ||
run: | | ||
echo "Indexing to Test." | ||
python -u scripts/index.py ${{ github.repository }} ${{ secrets.GITHUB_TOKEN }} ${{ github.event.inputs.release_version }} ${{ secrets.ES_INDEX_TEST }} | ||
- name: Trigger database update in Core repo | ||
run: | | ||
# Set the required variables | ||
repo_owner="MikroElektronika" | ||
repo_name="core_packages" | ||
event_type="trigger-workflow" | ||
version="${{ github.event.inputs.release_version }}" | ||
curl -L \ | ||
-X POST \ | ||
-H "Accept: application/vnd.github+json" \ | ||
-H "Authorization: Bearer ${{ secrets.MIKROE_ACTIONS_KEY }}" \ | ||
-H "X-GitHub-Api-Version: 2022-11-28" \ | ||
https://api.github.com/repos/$repo_owner/$repo_name/dispatches \ | ||
-d "{\"event_type\": \"$event_type\", \"client_payload\": {\"version\": \"$version\", \"index\": \"Test\", \"unit\": false, \"integration\": true}}" |