Skip to content

Commit

Permalink
Merge pull request #911 from UW-GAC/main
Browse files Browse the repository at this point in the history
Deploy to stage
  • Loading branch information
amstilp authored Feb 5, 2025
2 parents 4986d95 + e889c66 commit 69a18b3
Show file tree
Hide file tree
Showing 16 changed files with 199 additions and 139 deletions.
13 changes: 13 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
sort-direction: ascending

categories:
- title: "⬆️ Dependencies"
labels:
- "dependencies"
- "update-requirements-files"
- "combined-pr"

template: |
## What’s Changed
$CHANGES
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
uses: actions/[email protected]

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5.3.0
uses: actions/setup-python@v5.4.0
with:
python-version: ${{ matrix.python-version }}
cache: pip
Expand Down Expand Up @@ -99,7 +99,7 @@ jobs:
run: ls -lhta

- name: Upload coverage data
uses: actions/upload-artifact@v4.4.3
uses: actions/upload-artifact@v4.6.0
with:
name: coverage-data-${{ strategy.job-index }}
path: coverage-${{ strategy.job-index }}
Expand All @@ -114,7 +114,7 @@ jobs:
uses: actions/[email protected]

- name: Set up Python
uses: actions/setup-python@v5.3.0
uses: actions/setup-python@v5.4.0
with:
python-version: '3.10'

Expand All @@ -140,6 +140,6 @@ jobs:
python -m coverage report
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5.0.7
uses: codecov/codecov-action@v5.3.1
with:
token: ${{ secrets.CODECOV_TOKEN }}
2 changes: 1 addition & 1 deletion .github/workflows/pip-compile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
ref: ${{ github.head_ref }}

- name: Set up Python
uses: actions/setup-python@v5.3.0
uses: actions/setup-python@v5.4.0
with:
python-version: "3.10"

Expand Down
114 changes: 114 additions & 0 deletions .github/workflows/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
name: Release Drafter

on:
push:
# branches to consider in the event; optional, defaults to all
branches:
- deploy/production

permissions:
contents: read

jobs:
update_release_draft:
permissions:
# write permission is required to create a github release
contents: write
# write permission is required for autolabeler
# otherwise, read permission is required at least
pull-requests: read
runs-on: ubuntu-latest
steps:

- name: Get current date
id: get-date
run: |
export CURRENT_DATE=$(TZ=":America/Los_Angeles" date "+%Y-%m-%d")
echo "current_date=${CURRENT_DATE}" >> $GITHUB_OUTPUT
echo "Current date set to ${CURRENT_DATE}"
- name: Get number of releases for the current date
id: get-release-count
run: |
export RELEASE_COUNT=$(gh release list \
--repo ${{ github.repository }} \
--json tagName \
--exclude-drafts \
--jq "map(select(.tagName | startswith(\"${CURRENT_DATE}\")))|length" \
)
echo "release_count=${RELEASE_COUNT}" >> $GITHUB_OUTPUT
echo "Found ${RELEASE_COUNT} releases"
env:
CURRENT_DATE: ${{ steps.get-date.outputs.current_date }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Prepare release version
id: get-version
run: |
export VERSION="${CURRENT_DATE}"
if [ $RELEASE_COUNT -gt 0 ]; then
echo "Release already exists for version ${VERSION}"
echo "Appending release count to version"
export VERSION="${CURRENT_DATE}-${RELEASE_COUNT}"
fi
echo "version=${VERSION}" >> $GITHUB_OUTPUT
echo "Version set to ${VERSION}"
env:
CURRENT_DATE: ${{ steps.get-date.outputs.current_date }}
RELEASE_COUNT: ${{ steps.get-release-count.outputs.release_count }}


- name: Check that version doesn't exist
id: check-release
run: |
echo "Checking version ${VERSION}"
export CHECK=$(gh release list \
--repo ${{ github.repository }} \
--json tagName \
--exclude-drafts \
--jq "map(select(.tagName == \"${VERSION}\"))|length" \
)
echo "Found ${CHECK} releases"
if [ $CHECK -gt 0 ]; then
echo "Release already exists for version ${VERSION}"
exit 1
fi
env:
VERSION: ${{ steps.get-version.outputs.version }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Check that tag doesn't exist
id: check-tag
run: |
echo "Checking tag for version ${VERSION}"
# Query the API for this tag.
export CHECK=$(gh api \
-H "Accept: application/vnd.github+json" \
-H "X-GitHub-Api-Version: 2022-11-28" \
/repos/${{ github.repository }}/tags \
--jq "map(select(.name == \"${VERSION}\"))|length" \
)
echo "Found ${CHECK} tags"
if [ $CHECK -gt 0 ]; then
echo "Tag already exists for version ${VERSION}"
exit 1
fi
env:
VERSION: ${{ steps.get-version.outputs.version }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}


- uses: release-drafter/release-drafter@v6
with:
commitish: deploy/production
tag: ${{ steps.get-version.outputs.version }}
name: ${{ steps.get-version.outputs.version }}
version: ${{ steps.get-version.outputs.version }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ repos:

- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.8.1
rev: v0.9.4
hooks:
# Run the linter.
- id: ruff
Expand All @@ -21,7 +21,7 @@ repos:
- id: ruff-format

- repo: https://github.com/gitleaks/gitleaks
rev: v8.21.2
rev: v8.23.3
hooks:
- id: gitleaks

Expand Down
3 changes: 2 additions & 1 deletion config/settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@

LOCAL_APPS = [
"anvil_consortium_manager",
"anvil_consortium_manager.auditor",
"primed.users.apps.UsersConfig",
# Your stuff: custom apps go here
"primed.drupal_oauth_provider",
Expand Down Expand Up @@ -264,7 +265,7 @@
LOGGING = {
"version": 1,
"disable_existing_loggers": False,
"formatters": {"verbose": {"format": "%(levelname)s %(asctime)s %(module)s " "%(process)d %(thread)d %(message)s"}},
"formatters": {"verbose": {"format": "%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s"}},
"handlers": {
"console": {
"level": "DEBUG",
Expand Down
2 changes: 1 addition & 1 deletion config/settings/production.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
"()": "maintenance_mode.logging.RequireNotMaintenanceMode503",
},
},
"formatters": {"verbose": {"format": "%(levelname)s %(asctime)s %(module)s " "%(process)d %(thread)d %(message)s"}},
"formatters": {"verbose": {"format": "%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s"}},
"handlers": {
"mail_admins": {
"level": "ERROR",
Expand Down
Loading

0 comments on commit 69a18b3

Please sign in to comment.