From b37d047647ae23df5131c9891c70c153a0586627 Mon Sep 17 00:00:00 2001 From: Ranbir Aulakh Date: Wed, 18 Oct 2023 15:57:08 -0400 Subject: [PATCH] feat: Update GitHub actions (#23) * Update Github Actions --- ...entation.yaml => documentation-publish.yml} | 12 ++++++++---- .../workflows/osml-imagery-toolkit-build.yml | 10 ++++++++++ .../workflows/osml-imagery-toolkit-publish.yml | 18 ++++++++++++++++++ .github/workflows/python-publish.yml | 10 +++++----- .../{python-package.yml => python-tox.yml} | 14 ++++---------- 5 files changed, 45 insertions(+), 19 deletions(-) rename .github/workflows/{documentation.yaml => documentation-publish.yml} (76%) create mode 100644 .github/workflows/osml-imagery-toolkit-build.yml create mode 100644 .github/workflows/osml-imagery-toolkit-publish.yml rename .github/workflows/{python-package.yml => python-tox.yml} (76%) diff --git a/.github/workflows/documentation.yaml b/.github/workflows/documentation-publish.yml similarity index 76% rename from .github/workflows/documentation.yaml rename to .github/workflows/documentation-publish.yml index a9bc5ca..18bb5a1 100644 --- a/.github/workflows/documentation.yaml +++ b/.github/workflows/documentation-publish.yml @@ -1,12 +1,17 @@ -name: Docs -on: [push, pull_request, workflow_dispatch] +name: Generate and Publish Documentation for OSML Imagery Toolkit + +on: + workflow_call: + permissions: contents: write + jobs: docs: + if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - uses: actions/setup-python@v3 - name: Install dependencies run: | @@ -19,7 +24,6 @@ jobs: tox -e docs - name: Deploy uses: peaceiris/actions-gh-pages@v3.9.3 - if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} with: publish_branch: gh-pages github_token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/osml-imagery-toolkit-build.yml b/.github/workflows/osml-imagery-toolkit-build.yml new file mode 100644 index 0000000..e5015a7 --- /dev/null +++ b/.github/workflows/osml-imagery-toolkit-build.yml @@ -0,0 +1,10 @@ +name: "OSML Imagery Toolkit Build Workflow" + +on: + pull_request: + branches: ["main", "dev"] + +jobs: + Build_Validate_Tox: + uses: ./.github/workflows/python-tox.yml + secrets: inherit diff --git a/.github/workflows/osml-imagery-toolkit-publish.yml b/.github/workflows/osml-imagery-toolkit-publish.yml new file mode 100644 index 0000000..7dbc10c --- /dev/null +++ b/.github/workflows/osml-imagery-toolkit-publish.yml @@ -0,0 +1,18 @@ +name: "OSML Imagery Toolkit Build and Publish Workflow" + +on: + push: + branches: ["main"] + +jobs: + Build_Validate_Tox: + uses: ./.github/workflows/python-tox.yml + secrets: inherit + Publish_Python: + needs: [Build_Validate_Tox] + uses: ./.github/workflows/python-publish.yml + secrets: inherit + Publish_Documentation: + needs: [Publish_Python] + uses: ./.github/workflows/documentation-publish.yml + secrets: inherit diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml index bdaab28..942a1c4 100644 --- a/.github/workflows/python-publish.yml +++ b/.github/workflows/python-publish.yml @@ -6,9 +6,10 @@ # separate terms of service, privacy policy, and support # documentation. -name: Upload Python Package +name: Publish Python Package on: + workflow_call: release: types: [published] @@ -17,11 +18,10 @@ permissions: jobs: deploy: - + if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v3 with: @@ -33,7 +33,7 @@ jobs: - name: Build package run: python -m build - name: Publish package - uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 + uses: pypa/gh-action-pypi-publish@v1.8.10 with: user: __token__ password: ${{ secrets.PYPI_API_TOKEN }} diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-tox.yml similarity index 76% rename from .github/workflows/python-package.yml rename to .github/workflows/python-tox.yml index 225d42c..456c8f9 100644 --- a/.github/workflows/python-package.yml +++ b/.github/workflows/python-tox.yml @@ -1,27 +1,21 @@ # This workflow will install Python dependencies, run tests and lint with a single version of Python # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python -name: Tox Build/Validation +name: Build/Validation with Tox on: - push: - branches: [ "main" ] - pull_request: - branches: [ "main" ] + workflow_call: permissions: contents: read jobs: build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: - lfs: 'true' - ssh-key: ${{ secrets.git_ssh_key }} + lfs: 'true' - name: Set up Python 3.10 uses: actions/setup-python@v3 with: