Skip to content

Commit

Permalink
ci: simplify ci to one file (#492)
Browse files Browse the repository at this point in the history
  • Loading branch information
silentworks committed Aug 16, 2024
1 parent 4e7fea1 commit 12e57bd
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 323 deletions.
90 changes: 44 additions & 46 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,66 +1,64 @@
name: Release
name: CI/CD

on:
workflow_run:
workflows: ["Run Tests"]
branches: [master]
types: [completed]

permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
contents: write # needed for github actions bot to write to repo
pull-requests: write
push:
branches:
- master
pull_request:
workflow_dispatch:

jobs:
release-please:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
name: "Bump version, create changelog and publish"
environment:
name: pypi
url: https://pypi.org/p/postgrest
test:
name: Test / OS ${{ matrix.os }} / Python ${{ matrix.python-version }}
strategy:
matrix:
os: [ubuntu-latest]
python-version: [3.9, '3.10', '3.11', '3.12']
runs-on: ${{ matrix.os }}
steps:
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: 3.11
- name: Clone Repository
uses: actions/checkout@v4

- name: Set up Poetry
uses: abatilo/actions-poetry@v3
with:
poetry-version: 1.8.3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Set up Poetry
uses: abatilo/actions-poetry@v3.0.0
with:
poetry-version: 1.8.3

- name: Run Tests
run: make run_tests

- name: Upload Coverage
uses: codecov/codecov-action@v4.5.0
release-please:
needs: test
if: ${{ github.ref == 'refs/heads/master' && github.event_name == 'push' && github.repository_owner == 'supabase' }}
runs-on: ubuntu-latest
name: "Bump version and create changelog"
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
contents: write # needed for github actions bot to write to repo
pull-requests: write
steps:
- uses: googleapis/release-please-action@v4
id: release
with:
target-branch: ${{ github.ref_name }}

- if: ${{ steps.release.outputs }}
id: versions
run: |
set -ex
MAIN_RELEASE_VERSION=${{ steps.release.outputs.major }}.${{ steps.release.outputs.minor }}.${{ steps.release.outputs.patch }}
RELEASE_VERSION="$MAIN_RELEASE_VERSION"
RELEASE_NAME="v$RELEASE_VERSION"
RELEASE_CREATED='${{ steps.release.outputs.release_created }}'
PRS_CREATED='${{ steps.release.outputs.prs_created }}'
PR_TITLE='${{ github.event.workflow_run.head_commit.message }}'
echo "MAIN_RELEASE_VERSION=${MAIN_RELEASE_VERSION}" >> "${GITHUB_OUTPUT}"
echo "RELEASE_VERSION=${RELEASE_VERSION}" >> "${GITHUB_OUTPUT}"
echo "RELEASE_CREATED=${RELEASE_CREATED}" >> "${GITHUB_OUTPUT}"
echo "RELEASE_NAME=${RELEASE_NAME}" >> "${GITHUB_OUTPUT}"
echo "PRS_CREATED=${PRS_CREATED}" >> "${GITHUB_OUTPUT}"
echo "PR_TITLE=${PR_TITLE}" >> "${GITHUB_OUTPUT}"
publish:
needs: release-please
if: ${{ startsWith(github.event.head_commit.message, 'chore(master)') && github.ref == 'refs/heads/master' && github.event_name == 'push' && github.repository_owner == 'supabase' }}
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' && startsWith(github.event.workflow_run.head_commit.message, 'chore(master)') }}
name: "Bump version, create changelog and publish"
name: "Publish to PyPi"
environment:
name: pypi
url: https://pypi.org/p/postgrest
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
contents: write # needed for github actions bot to write to repo
steps:
- name: Set up Python 3.11
uses: actions/setup-python@v5
Expand Down
32 changes: 0 additions & 32 deletions .github/workflows/tests.yml

This file was deleted.

Loading

0 comments on commit 12e57bd

Please sign in to comment.