build(deps-dev): update ruff requirement from ^0.5.0 to ^0.6.9 #37
Workflow file for this run
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
name: Deployment CD | |
env: | |
DOCKERREPO: seblum/octivbooker | |
on: | |
workflow_dispatch: | |
push: | |
paths: | |
- 'pyproject.toml' # This will trigger the workflow only if pyproject.toml is changed | |
jobs: | |
get-tag: | |
name: Get Tag | |
runs-on: ubuntu-latest | |
outputs: | |
PACKAGE_VERSION: ${{ steps.extract_version.outputs.PACKAGE_VERSION }} | |
versions_changed: ${{ steps.compare_versions.outputs.versions_changed }} | |
steps: | |
- | |
name: Checkout code | |
uses: actions/checkout@v4 | |
- | |
name: Extract version from pyproject.toml | |
id: extract_version | |
run: | | |
VERSION=$(sed -n 's/^version = "\(.*\)"/\1/p' ./pyproject.toml) | |
echo "PACKAGE_VERSION=$VERSION" >> $GITHUB_OUTPUT | |
- | |
name: Get previous version | |
id: get_previous_version | |
run: | | |
PREVIOUS_VERSION=$(git show HEAD~1:pyproject.toml | sed -n 's/^version = "\(.*\)"/\1/p') | |
echo "PREVIOUS_VERSION=$PREVIOUS_VERSION" >> $GITHUB_OUTPUT | |
- | |
name: Compare versions | |
id: compare_versions | |
run: | | |
if [ "${{ steps.extract_version.outputs.PACKAGE_VERSION }}" = "${{ steps.get_previous_version.outputs.PREVIOUS_VERSION }}" ]; then | |
echo "Version has not changed. Exiting." | |
echo "versions_changed=false" >> $GITHUB_OUTPUT | |
exit 0 | |
else | |
echo "Version has changed. Proceeding." | |
echo "versions_changed=true" >> $GITHUB_OUTPUT | |
fi | |
deploy: | |
name: "📦 Build & Push : ${{ matrix.tags }}" | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
tags: ["latest","v${{ needs.get-tag.outputs.PACKAGE_VERSION }}"] | |
needs: get-tag | |
if: ${{ needs.get-tag.outputs.versions_changed }} | |
steps: | |
- | |
name: Checkout code | |
uses: actions/checkout@v4 | |
- | |
name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- | |
name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- | |
name: Login to DockerHub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- | |
name: Build and push | |
uses: docker/build-push-action@v6 | |
with: | |
file: ./poetry.Dockerfile | |
push: true | |
tags: ${{ env.DOCKERREPO }}:${{ matrix.tags }} | |
run-on-schedule-version-bump: | |
name: 🗃️ Create Version Bump PR | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
issues: write | |
pull-requests: write | |
actions: write | |
needs: | |
- deploy | |
- get-tag | |
env: | |
TAG_VERSION: ${{ needs.get-tag.outputs.PACKAGE_VERSION }} | |
steps: | |
- | |
name: Checkout code with full history | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
token: ${{ secrets.WORKFLOW_TOKEN }} | |
- | |
name: Create new Branch | |
run: | | |
git fetch origin | |
git checkout -b update-run-on-schedule-version-${{ env.TAG_VERSION }} origin/master | |
git pull --rebase | |
git push origin update-run-on-schedule-version-${{ env.TAG_VERSION }} --force | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- | |
name: Update Version in pyproject.toml | |
run: | | |
sed -i "s/^ DOCKER_IMAGE: \"octivbooker:.*\"/ DOCKER_IMAGE: \"octivbooker:v${{ env.TAG_VERSION }}\"/" .github/workflows/run-on-schedule.yml | |
- | |
name: Verify Update | |
run: cat .github/workflows/run-on-schedule.yml | |
- | |
name: Commit changes | |
run: | | |
git config --global user.name 'github-actions[bot]' | |
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
git add .github/workflows/run-on-schedule.yml | |
git commit -m "Update DOCKER_IMAGE: to ${{ env.TAG_VERSION }}" | |
git push origin update-run-on-schedule-version-${{ env.TAG_VERSION }} | |
- | |
name: Install GitHub CLI | |
run: | | |
sudo apt-get install gh | |
- | |
name: Create Pull Request | |
run: | | |
PR_EXISTS=$(gh pr list --head update-run-on-schedule-version-${{ env.TAG_VERSION }} --json number --jq '.[0].number' || echo "") | |
if [ -z "$PR_EXISTS" ]; then | |
gh pr create --title "Bump run-on-schedule.yml version to ${{ env.TAG_VERSION }}" \ | |
--body "This PR updates the version in run-on-schedule.yml to ${{ env.TAG_VERSION }}." \ | |
--base master \ | |
--head update-run-on-schedule-version-${{ env.TAG_VERSION }} | |
else | |
echo "PR already exists." | |
fi | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |