From 79146d004f3b9c8187b583733da7210854449272 Mon Sep 17 00:00:00 2001 From: stdavis Date: Thu, 23 Jan 2025 16:20:29 -0700 Subject: [PATCH] ci: standardize actions --- .github/workflows/push.yml | 3 +- .github/workflows/release.yml | 70 +++++++++++++++++++++++++++++++++++ .vscode/settings.json | 10 +++-- src/projectname/version.py | 5 +-- 4 files changed, 78 insertions(+), 10 deletions(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index be42f79..306ecf0 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -17,8 +17,6 @@ jobs: permissions: contents: write pull-requests: write - outputs: - release_created: ${{ steps.release-please.outputs.release_created }} steps: - name: 🚀 Create Release @@ -32,3 +30,4 @@ jobs: github-app-key: ${{ secrets.UGRC_RELEASE_BOT_APP_KEY }} github-app-name: ${{ secrets.UGRC_RELEASE_BOT_NAME }} github-app-email: ${{ secrets.UGRC_RELEASE_BOT_EMAIL }} + extra-files: src/projectname/version.py diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..2398281 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,70 @@ +name: Release Events +on: + release: + types: [published] + +env: + GH_TOKEN: ${{ github.token }} + +jobs: + build: + # disabled for this project since we don't want to publish it + if: false + name: Build + runs-on: ubuntu-latest + steps: + - name: ⬇️ Set up code + uses: actions/checkout@v4 + with: + show-progress: false + + - name: 🐍 Set up Python + uses: actions/setup-python@v5 + with: + python-version-file: .python-version + cache: pip + cache-dependency-path: setup.py + + - name: 📦 Build package + run: pipx run build + + - name: ⬆️ Upload artifacts + uses: actions/upload-artifact@v4 + with: + name: build-artifacts + path: dist + retention-days: 1 + + publish: + name: Publish + runs-on: ubuntu-latest + needs: build + environment: + name: prod + url: https://pypi.org/project/ + permissions: + id-token: write + + steps: + - name: ⬇️ Download artifacts + uses: actions/download-artifact@v4 + with: + name: build-artifacts + path: dist + + - name: 🚀 Publish to PyPI + uses: pypa/gh-action-pypi-publish@release/v1 + + notify: + name: Notifications + runs-on: ubuntu-latest + needs: publish + permissions: + contents: read + pull-requests: write + issues: write + steps: + - name: Release Notifier + uses: agrc/release-issue-notifications-action@v1 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.vscode/settings.json b/.vscode/settings.json index 1727358..8da5117 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -14,9 +14,13 @@ "oidc", "opensgid", "pgsql", + "pipx", + "projectname", "psycopg", "pygsheets", "pyodbc", + "pypa", + "pypi", "pytest", "rindex", "sgid", @@ -25,9 +29,7 @@ "worknote" ], "editor.formatOnSave": true, - "editor.rulers": [ - 120 - ], + "editor.rulers": [120], "coverage-gutters.showGutterCoverage": false, "coverage-gutters.showLineCoverage": true, "coverage-gutters.showRulerCoverage": false, @@ -40,6 +42,6 @@ "source.organizeImports": "explicit" }, "[python]": { - "editor.defaultFormatter": "charliermarsh.ruff", + "editor.defaultFormatter": "charliermarsh.ruff" } } diff --git a/src/projectname/version.py b/src/projectname/version.py index e95cd33..cac63f5 100644 --- a/src/projectname/version.py +++ b/src/projectname/version.py @@ -1,6 +1,3 @@ -"""A single source of truth for the version in a programmatically-accessible variable. - -This must only include a single line: __version__ = 'x.y.z' -""" +"""A single source of truth for the version in a programmatically-accessible variable.""" __version__ = "1.0.2"