-
Notifications
You must be signed in to change notification settings - Fork 0
102 lines (84 loc) · 3.38 KB
/
main.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
93
94
95
96
97
98
99
100
101
102
name: Deploy PyFunceble Web-Worker
on:
push:
branches:
- master
- main
schedule:
- cron: "0 2 * * *"
jobs:
lint:
name: Lint PyFunceble Web-Worker
runs-on: "ubuntu-latest"
strategy:
fail-fast: false
matrix:
python_version:
- "3.9.1"
steps:
- uses: actions/checkout@v2
name: Clone repository
- name: Set up Python ${{ matrix.python_version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python_version }}
- name: Install dependencies
run: |
pip install flake8
- name: Lint with Flake8
run: flake8 pyfunceble_webworker
push_to_github_packages:
needs: lint
name: Build and publish docker image to GitHub Packages
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Get project version
run:
echo "WEB_WORKER_VERSION=$(python setup.py --version)" >> $GITHUB_ENV
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Convert repository to lower case
id: repository_name_conversion
uses: ASzc/change-string-case-action@v1
with:
string: ${{ github.repository }}
- name: Login to GitHub Container Registry
uses: docker/#-action@v1
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.REGISTRY_TOKEN }}
- name: Push stable image to GitHub Packages
uses: docker/build-push-action@v2
with:
context: .
file: Dockerfile.pyfunceble-dev
push: true
tags: |
ghcr.io/${{ steps.repository_name_conversion.outputs.lowercase }}/web-worker-dev:latest
ghcr.io/${{ steps.repository_name_conversion.outputs.lowercase }}/web-worker-dev:${{ github.sha }}
ghcr.io/${{ steps.repository_name_conversion.outputs.lowercase }}/web-worker-dev:${{ env.WEB_WORKER_VERSION }}
labels: |
org.opencontainers.image.title=${{ github.event.repository.name }}
org.opencontainers.image.description=${{ github.event.repository.description }}
org.opencontainers.image.url=${{ github.event.repository.html_url }}
org.opencontainers.image.source=https://github.com/${{ steps.repository_name_conversion.outputs.lowercase }}
- name: Push dev image to GitHub Packages
uses: docker/build-push-action@v2
with:
context: .
file: Dockerfile.pyfunceble
push: true
tags: |
ghcr.io/${{ steps.repository_name_conversion.outputs.lowercase }}/web-worker:latest
ghcr.io/${{ steps.repository_name_conversion.outputs.lowercase }}/web-worker:${{ github.sha }}
ghcr.io/${{ steps.repository_name_conversion.outputs.lowercase }}/web-worker:${{ env.WEB_WORKER_VERSION }}
labels: |
org.opencontainers.image.title=${{ github.event.repository.name }}
org.opencontainers.image.description=${{ github.event.repository.description }}
org.opencontainers.image.url=${{ github.event.repository.html_url }}
org.opencontainers.image.source=https://github.com/${{ steps.repository_name_conversion.outputs.lowercase }}