Skip to content

Clean up workflows and add push workflow using reusables #12

Clean up workflows and add push workflow using reusables

Clean up workflows and add push workflow using reusables #12

name: Push Default and Deploy
on:
push:
branches:
- main
workflow_dispatch:
permissions: # Permissions for OIDC
id-token: write
contents: read
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- name: Before composite action
run: echo "This is a step before the composite action."
- name: Build and Test Python Project
uses: TomSmithCoding/python-build-test-custom-action@main
with:
python-version: "3.x"
output-path: "src"
- name: After composite action
run: echo "This is a step after the composite action."
deploy-mock-dev:
runs-on: ubuntu-latest
needs: build-and-test
environment:
name: DEV
#url: https://dev.example.com
steps:
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: pythonproject-build
path: pythonproject-build
- name: Prove files are there
run: |
echo "Files in the build directory:"
ls -la
ls -la pythonproject-build
- name: Deploy to mock dev
run: |
echo "Deploying to mock server..."
# Add your deployment commands here
# For example, you can use scp or rsync to copy files to the server
# scp -r pythonproject-build/* user@mockserver:/path/to/deploy
deploy-mock-staging:
runs-on: ubuntu-latest
needs: build-and-test
environment:
name: STAGING
#url: https://staging.example.com
steps:
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: pythonproject-build
path: pythonproject-build
- name: Prove files are there
run: |
echo "Files in the build directory:"
ls -la
ls -la pythonproject-build
- name: Deploy to mock staging
run: |
echo "Deploying to mock server..."
# Add your deployment commands here
# Login to azure step followed by Deploy to azure step
# For example, you can use scp or rsync to copy files to the server
# scp -r pythonproject-build/* user@mockserver:/path/to/deploy
deploy-mock-production:
runs-on: ubuntu-latest
needs:
- deploy-mock-dev
- deploy-mock-staging
environment:
name: PROD
#url: https://prod.example.com
steps:
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: pythonproject-build
path: pythonproject-build
- name: Prove files are there
run: |
echo "Files in the build directory:"
ls -la
ls -la pythonproject-build
- name: Deploy to mock production
run: |
echo "Deploying to mock server..."
# Add your deployment commands here
# For example, you can use scp or rsync to copy files to the server
# scp -r pythonproject-build/* user@mockserver:/path/to/deploy