-
Notifications
You must be signed in to change notification settings - Fork 0
92 lines (92 loc) · 3.09 KB
/
docker.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
# The following workflow provides an opinionated template you can customize for your own needs.
#
# If you are not an Octopus user, the "Push to Octopus", "Generate Octopus Deploy build information",
# and "Create Octopus Release" steps can be safely deleted.
#
# To configure Octopus, set the OCTOPUS_API_TOKEN secret to the Octopus API key, and
# set the OCTOPUS_SERVER_URL secret to the Octopus URL.
#
# Double check the "project" and "deploy_to" properties in the "Create Octopus Release" step
# match your Octopus projects and environments.
#
# Get a trial Octopus instance from https://octopus.com/start
name: Docker Build
'on':
workflow_dispatch: {}
push: {}
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
with:
fetch-depth: '0'
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_SAMPLES_USERNAME }}
password: ${{ secrets.DOCKERHUB_SAMPLES_PASSWORD }}
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.x
- name: Install GitVersion
uses: gittools/actions/gitversion/[email protected]
with:
versionSpec: 5.x
- id: determine_version
name: Determine Version
uses: gittools/actions/gitversion/[email protected]
with:
additionalArguments: /overrideconfig mode=Mainline
- name: Install Octopus Deploy CLI
uses: OctopusDeploy/[email protected]
with:
version: latest
- name: Install Dependencies
run: pip install -r requirements.txt
shell: bash
- name: List Dependencies
run: pip install pipdeptree; pipdeptree > dependencies.txt
shell: bash
- name: Collect Dependencies
uses: actions/upload-artifact@v2
with:
name: Dependencies
path: dependencies.txt
- name: List Dependency Updates
run: pip list --outdated --format=freeze > dependencyUpdates.txt || true
shell: bash
- name: Collect Dependency Updates
uses: actions/upload-artifact@v2
with:
name: Dependencies Updates
path: dependencyUpdates.txt
- name: Test
run: pip install pytest; pytest --junitxml=results.xml
shell: bash
- if: always()
name: Report
uses: dorny/test-reporter@v1
with:
name: Python Tests
path: results.xml
reporter: java-junit
fail-on-error: 'false'
- name: Build and push
uses: docker/build-push-action@v3
with:
push: true
tags: octopussamples/randomquotespython:${{ steps.determine_version.outputs.semVer }}
- name: Create Octopus Release
uses: OctopusDeploy/[email protected]
with:
api_key: ${{ secrets.OCTOPUS_API_TOKEN }}
project: RandomQuotes-Python
server: ${{ secrets.OCTOPUS_SERVER_URL }}
deploy_to: Dev
packages: Deploy container to Kubernetes:randomquotes:${{ steps.determine_version.outputs.semVer }}