diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 945eea5..a011f2c 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -3,7 +3,8 @@ name: Deploy Python Application on: push: branches: - - main + - master + - dev jobs: build-and-deploy: @@ -11,10 +12,10 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: '3.x' @@ -24,8 +25,7 @@ jobs: pip install -r requirement-test.txt - name: Run tests - run: | - pytest main_test.py + run: pytest # - name: Deploy to Cloud Functions # run: | diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 96a80f4..7fc78f9 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,6 +2,9 @@ name: Release Process on: pull_request: branches: [master] + types: [closed] + push: + branches: [master] workflow_dispatch: jobs: @@ -33,7 +36,6 @@ jobs: REPO_NAME: ${{ env.REPO_NAME }} with: github_token: ${{ secrets.GITHUB_TOKEN }} - module_name: 'poc_module' - name: Tag generated run: echo "RELEASE_TAG=${{ steps.semantic_release.outputs.release_version }}" >> $GITHUB_ENV @@ -47,10 +49,21 @@ jobs: ## IMPORTANT: this permission is mandatory for Trusted Publishing id-token: write steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.x' + + - name: Install build and twine + run: python -m pip install --upgrade pip build twine bump2version wheel + - name: Publish run: | python -m build twine upload dist/* --repository-url https://upload.pypi.org/legacy/ --verbose env: TWINE_USERNAME: __token__ - TWINE_PASSWORD: ${{secrets.PYPI_TOKEN}} + TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} diff --git a/main.py b/main.py index 3391d10..041ff7d 100644 --- a/main.py +++ b/main.py @@ -1,11 +1,14 @@ __version__ = "0.1.0" from flask import Flask, request, jsonify -from google.cloud import storage +import os app = Flask(__name__) @app.route('/') def index(): """Return a friendly HTTP greeting.""" - return "Hello, World!" \ No newline at end of file + return "Hello, World!" + +if __name__ == '__main__': + app.run(debug=True, host="0.0.0.0", port=8080) \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 84f360a..1406177 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,5 @@ -Flask==2.0.3 +Flask==3.0.3 google-cloud-functions==1.0.0 -request==2.26.0 \ No newline at end of file +requests==2.26.0 +Werkzeug==3.0.3 +gunicorn==23.0.0 \ No newline at end of file