Skip to content

Commit

Permalink
Merge pull request #459 from Parallels/add-pypi-deployment
Browse files Browse the repository at this point in the history
updating pipeline to publish package
  • Loading branch information
cjlapao authored Aug 30, 2023
2 parents 13ad4d2 + ab21802 commit a2f07c0
Show file tree
Hide file tree
Showing 6 changed files with 42 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ jobs:
pip install pytest
pip install -r requirements.txt
pip install -r requirements-dev.txt
- name: Run tests
if: false
run: pytest
Expand All @@ -37,10 +38,12 @@ jobs:
uses: actions/setup-python@v2
with:
python-version: '3.x'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Build Docker image
uses: docker/build-push-action@v2
with:
Expand Down
22 changes: 22 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,17 @@ jobs:

steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'

- name: Install Packge builder
run: |
python -m pip install --upgrade pip
python -m pip install --upgrade build
pip install -r requirements.txt
- name: Parse version from package.json
run: |
echo "EXT_VERSION=$(cat version.json | jq -r '.version')" >> $GITHUB_ENV
Expand All @@ -78,6 +89,17 @@ jobs:
push: true
tags: cjlapao/rq-dashboard:${{ env.EXT_VERSION }},cjlapao/rq-dashboard:latest

- name: Build Python package
run: |
python -m build --sdist --wheel
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_TOKEN }}
repository-url: https://pypi.org/project/rq-dashboard/
packages-dir: /dist

- name: Create GitHub release
uses: actions/create-release@v1
env:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ jobs:
git checkout -b release/$NEW_VERSION
echo "{ \"version\": \"$NEW_VERSION\" }" > version.json
./scripts/workflows/change_version.sh ./rq_dashboard/version.py $NEW_VERSION
git add version.json
git commit -m "Release extension version $NEW_VERSION"
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ dump.rdb
.tox/

.python-version
venv/
venv/
.pytest_cache/
2 changes: 1 addition & 1 deletion rq_dashboard/version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
VERSION = "0.6.0"
VERSION = "0.6.5"
13 changes: 13 additions & 0 deletions scripts/workflows/change_version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

# Get the filepath and version number from the arguments
filepath=$1
new_version=$2

# Get the current version number
current_version=$(cat $filepath | grep -oE 'VERSION = "[0-9]+\.[0-9]+\.[0-9]+' | cut -d'"' -f2)

# Replace the old version number with the new one
sed -i'' -e "s/$current_version/$new_version/g" "$filepath"

echo "Version number updated from $current_version to $new_version in $filepath"

0 comments on commit a2f07c0

Please sign in to comment.