Simple Python Flask web application designed for running in containers for demos
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

72 lines
2.0 KiB

name: CI Build App
on:
push:
branches: [master]
paths:
- "src/**"
pull_request:
env:
IMAGE_REG: ghcr.io
IMAGE_REPO: benc-uk/python-demoapp
jobs:
test:
name: "Tests & Linting"
runs-on: ubuntu-latest
steps:
- name: "Checkout"
uses: actions/checkout@v2
- name: "Run linting"
run: make lint
# - name: "Run tests"
# run: make test-report
# - name: "Upload test results"
# uses: actions/upload-artifact@v2
# # Disabled when running locally with the nektos/act tool
# if: ${{ always() && !env.ACT }}
# with:
# name: test-results
# path: blah
build:
name: "Build & Push Image"
needs: test
runs-on: ubuntu-latest
steps:
- name: "Checkout"
uses: actions/checkout@v2
# Nicer than using github runid, I think, will be picked up automatically by make
- name: "Create datestamp image tag"
run: echo "IMAGE_TAG=$(date +%d-%m-%Y.%H%M)" >> $GITHUB_ENV
- name: "Docker build image"
run: make image
# Only when pushing to default branch (e.g. master or main), then push image to registry
- name: Push to container registry
if: github.ref == 'refs/heads/master' && github.event_name == 'push'
run: |
echo ${{ secrets.CR_PAT }} | docker login $IMAGE_REG -u $GITHUB_ACTOR --password-stdin
make push
- name: "Trigger AKS release pipeline"
if: github.ref == 'refs/heads/master'
uses: benc-uk/workflow-dispatch@v1
with:
workflow: "CD Release - AKS"
token: ${{ secrets.CR_PAT }}
inputs: '{ "IMAGE_TAG": "${{ env.IMAGE_TAG }}" }'
- name: "Trigger Azure web app release pipeline"
if: github.ref == 'refs/heads/master'
uses: benc-uk/workflow-dispatch@v1
with:
workflow: "CD Release - Webapp"
token: ${{ secrets.CR_PAT }}
inputs: '{ "IMAGE_TAG": "${{ env.IMAGE_TAG }}" }'