Skip to content

Commit

Permalink
Merge pull request #26 from mlibrary/add-update-dependencies-gha
Browse files Browse the repository at this point in the history
Add update dependencies gha workflow
  • Loading branch information
niquerio authored Nov 20, 2024
2 parents a3893cf + d226c06 commit 41f41fb
Show file tree
Hide file tree
Showing 2 changed files with 81 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .github/update_dependencies_template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Overview

Monthly dependency updates for aim-py

## Poetry

```text
POETRY_SUMMARY
```
72 changes: 72 additions & 0 deletions .github/workflows/update-dependencies.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Update dependencies

on:
workflow_dispatch:
schedule:
- cron: '0 8 1 * *' #8AM first of the month


jobs:
update:
runs-on: ubuntu-latest
outputs:
sha: ${{ steps.cpr.outputs.pull-request-head-sha }}
steps:
- uses: actions/checkout@v4
- name: Create .env file
run: cat env.* > .env
- name: Load .env file
uses: xom9ikk/[email protected]
- name: Install poetry
run: |
echo "/root/.local/bin" >> $GITHUB_PATH
pipx install poetry
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: '3.11'
cache: 'poetry'
- run: poetry install
- name: Get python packages to update
run: poetry show -o > /tmp/poetry_summary.txt
- name: Update packages
run: poetry update
- name: Run tests
env:
CI: "true"
run: poetry run pytest
- name: generate pr body
run: |
sed $'/POETRY_SUMMARY/{r /tmp/poetry_summary.txt\nd}' .github/update_dependencies_template.md > /tmp/pr_body.md
- name: Get PR title
run: echo "PR_TITLE=$(date +'%B %Y') dependency updates" >> $GITHUB_ENV
- name: Create Pull Request
id: cpr
uses: peter-evans/create-pull-request@v6
with:
branch: update-dependencies
commit-message: "Update dependencies"
title: ${{ env.PR_TITLE }}
body-path: /tmp/pr_body.md
reviewers: niquerio, dfulmer

build-unstable:
needs: update
name: Build unstable ${{ needs.update.outputs.sha }}
uses: mlibrary/platform-engineering-workflows/.github/workflows/build-unstable.yml@v1
with:
image_name: ${{ vars.IMAGE_NAME }}
tag: ${{ needs.update.outputs.sha}}
dockerfile: Dockerfile
secrets: inherit

deploy-unstable:
needs: build-unstable
name: Deploy to workshop
uses: mlibrary/platform-engineering-workflows/.github/workflows/deploy.yml@v1
with:
image: ${{ needs.build-unstable.outputs.image }}
file: environments/digifeeds/workshop/app-image.txt
CONFIG_REPO_RW_APP_ID: ${{ vars.CONFIG_REPO_RW_APP_ID }}
CONFIG_REPO_FULL_NAME: ${{ vars.CONFIG_REPO_FULL_NAME }}
secrets: inherit

0 comments on commit 41f41fb

Please sign in to comment.