Skip to content

Commit

Permalink
build: update main branch name in semver
Browse files Browse the repository at this point in the history
  • Loading branch information
jjjermiah committed Mar 16, 2024
1 parent 768124a commit 4e96310
Show file tree
Hide file tree
Showing 2 changed files with 142 additions and 142 deletions.
282 changes: 141 additions & 141 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
python-version: ["3.12"]
# os: [ubuntu-latest, macos-latest, macos-14]
# python-version: ["3.12", "3.11"]
# os: [ubuntu-latest]
# python-version: ["3.12"]
os: [ubuntu-latest, macos-latest, macos-14]
python-version: ["3.12", "3.11"]

steps:
- uses: actions/checkout@v3
Expand Down Expand Up @@ -97,10 +97,10 @@ jobs:
issues: write
pull-requests: write

# needs: [Unit-Tests]
needs: [Unit-Tests]

# if pulling to main, deploy to PyPI
# if: github.ref == 'refs/heads/main'
if: github.ref == 'refs/heads/main'

# Set up operating system
runs-on: ubuntu-latest
Expand Down Expand Up @@ -210,138 +210,138 @@ jobs:
ghcr.io/${{ github.repository }}/nbiatoolkit:latest
labels: ${{ steps.meta.outputs.labels }}

# test_install_withPyPi:
# needs: Continuous-Deployment
# runs-on: ${{ matrix.os }}
# strategy:
# matrix:
# os: [ubuntu-latest, macos-latest, macos-14]
# python-version: ["3.12", "3.11"]

# steps:
# - uses: actions/checkout@v3

# - name: Set up Python ${{ matrix.python-version }}
# uses: actions/setup-python@v4
# with:
# python-version: ${{ matrix.python-version }}

# - name: Install using PyPi
# run: |
# pip install nbiatoolkit;
# NBIAToolkit


# test_image_with_new_tag:
# needs: Continuous-Deployment
# runs-on: ubuntu-latest
# steps:
# - name: Checkout code
# uses: actions/checkout@v3

# - name: Test Image With new Tag
# run: |
# # test image with latest tag
# docker run --rm \
# ${{ secrets.DOCKERHUB_USERNAME }}/nbiatoolkit:${{ steps.release.outputs.tag }} \
# NBIAToolkit


# test_image_with_latest_tag:
# needs: Continuous-Deployment
# runs-on: ubuntu-latest
# steps:
# - name: Checkout code
# uses: actions/checkout@v2

# - name: Test Image with "latest" Tag
# run: |
# docker run --rm \
# ${{ secrets.DOCKERHUB_USERNAME }}/nbiatoolkit:latest \
# NBIAToolkit

# Update-README:
# needs: Continuous-Deployment
# runs-on: ubuntu-latest
# # if: jobs.Continuous-Deployment.outputs.released == 'true'
# steps:
# - name: Checkout code
# uses: actions/checkout@v3

# - name: Get Current branch
# run: |
# echo "Current branch is: ${{ github.ref }}"
# echo "Current branch is: ${{ github.head_ref }}"
# echo "Current branch is: ${{ github.base_ref }}"
# echo "Current branch is: ${{ github.event_name }}"

# # if main, then git pull main
# if [ "${{ github.ref }}" == "refs/heads/main" ]; then
# git pull origin main
# fi

# # fix diverged branch
# git fetch origin ${{ github.head_ref }}
# git checkout ${{ github.head_ref }}

# - name: Set up Python ${{ matrix.python-version }}
# uses: actions/setup-python@v4
# with:
# python-version: ${{ matrix.python-version }}

# - name: Install using PyPi
# run: |
# # update pip
# pip install .
# NBIAToolkit

# - name: Update README code block
# run: |
# awk '/``` bash NBIAToolkit-Output/ {
# print "``` bash NBIAToolkit-Output";
# print "> NBIAToolkit --version";
# system("NBIAToolkit --version");
# f=1;
# next
# } f && /```/ {
# print "```";
# f=0;
# next
# } !f' README.md > temp && mv temp README.md

# - name: Commit and push changes
# run: |
# LATEST_TAG=$(curl -s \
# "https://api.github.com/repos/${{ github.repository }}/releases/latest" \
# | jq -r .tag_name | sed 's/^v//')
# echo "LATEST_TAG=${LATEST_TAG}"
# # Check for changes
# if [[ $(git status --porcelain) ]]; then
# # Changes are present
# echo "Changes found. Committing and pushing..."

# git config --global user.name 'jjjermiah'
# git config --global user.email 'jjjermiah@users.noreply.github.com'

# # Add all changes
# git add .

# # Commit with a timestamp
# git commit -m "chore: Update README: $LATEST_TAG"

# # Push changes to the remote repository
# # if github.head_ref is not null
# # then push to the branch
# # else push to the base branch
# if [ -n "${{ github.head_ref }}" ]; then
# git push origin HEAD:${{ github.head_ref }}
# else
# git push origin HEAD:${{ github.ref }}
# fi


# echo "Changes committed and pushed successfully."
# else
# # No changes
# echo "No changes found. Nothing to commit or push."
# fi
test_install_withPyPi:
needs: Continuous-Deployment
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, macos-14]
python-version: ["3.12", "3.11", "3.10"]

steps:
- uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install using PyPi
run: |
pip install nbiatoolkit;
NBIAToolkit
test_image_with_new_tag:
needs: Continuous-Deployment
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Test Image With new Tag
run: |
# test image with latest tag
docker run --rm \
${{ secrets.DOCKERHUB_USERNAME }}/nbiatoolkit:${{ steps.release.outputs.tag }} \
NBIAToolkit
test_image_with_latest_tag:
needs: Continuous-Deployment
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Test Image with "latest" Tag
run: |
docker run --rm \
${{ secrets.DOCKERHUB_USERNAME }}/nbiatoolkit:latest \
NBIAToolkit
Update-README:
needs: Continuous-Deployment
runs-on: ubuntu-latest
# if: jobs.Continuous-Deployment.outputs.released == 'true'
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Get Current branch
run: |
echo "Current branch is: ${{ github.ref }}"
echo "Current branch is: ${{ github.head_ref }}"
echo "Current branch is: ${{ github.base_ref }}"
echo "Current branch is: ${{ github.event_name }}"
# if main, then git pull main
if [ "${{ github.ref }}" == "refs/heads/main" ]; then
git pull origin main
fi
# fix diverged branch
git fetch origin ${{ github.head_ref }}
git checkout ${{ github.head_ref }}
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- name: Install using PyPi
run: |
# update pip
pip install .
NBIAToolkit
- name: Update README code block
run: |
awk '/``` bash NBIAToolkit-Output/ {
print "``` bash NBIAToolkit-Output";
print "> NBIAToolkit --version";
system("NBIAToolkit --version");
f=1;
next
} f && /```/ {
print "```";
f=0;
next
} !f' README.md > temp && mv temp README.md
- name: Commit and push changes
run: |
LATEST_TAG=$(curl -s \
"https://api.github.com/repos/${{ github.repository }}/releases/latest" \
| jq -r .tag_name | sed 's/^v//')
echo "LATEST_TAG=${LATEST_TAG}"
# Check for changes
if [[ $(git status --porcelain) ]]; then
# Changes are present
echo "Changes found. Committing and pushing..."
git config --global user.name 'jjjermiah'
git config --global user.email 'jjjermiah@users.noreply.github.com'
# Add all changes
git add .
# Commit with a timestamp
git commit -m "chore: Update README: $LATEST_TAG"
# Push changes to the remote repository
# if github.head_ref is not null
# then push to the branch
# else push to the base branch
if [ -n "${{ github.head_ref }}" ]; then
git push origin HEAD:${{ github.head_ref }}
else
git push origin HEAD:${{ github.ref }}
fi
echo "Changes committed and pushed successfully."
else
# No changes
echo "No changes found. Nothing to commit or push."
fi
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ changelog_file = "docs/project_info/CHANGELOG.md"
exclude_commit_types = ["docs", "style", "refactor", "test", "chore"]

[tool.semantic_release.branches.main]
match = "(main|master|development)"
match = "(main|master)"


[tool.semantic_release.commit_parser_options]
Expand Down

0 comments on commit 4e96310

Please sign in to comment.