-
Notifications
You must be signed in to change notification settings - Fork 0
126 lines (105 loc) · 4.25 KB
/
main.yaml
File metadata and controls
126 lines (105 loc) · 4.25 KB
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
name: Deploy PyFunceble Web-Worker
on:
push:
branches:
- master
- dev
schedule:
- cron: "0 2 * * *"
workflow_dispatch: {}
jobs:
lint:
name: Lint PyFunceble Web-Worker
runs-on: "ubuntu-latest"
strategy:
fail-fast: false
matrix:
python_version:
- "3.13"
steps:
- uses: actions/checkout@v6
name: Clone repository
- name: Set up Python ${{ matrix.python_version }}
uses: actions/setup-python@v6
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
permissions:
contents: read
packages: write
attestations: write
id-token: write
steps:
- name: Checkout Repository
uses: actions/checkout@v6
- name: Get project version
run: echo "WEB_WORKER_VERSION=$(python setup.py --version)" >> $GITHUB_ENV
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Convert repository to lower case
id: repository_name_conversion
uses: ASzc/change-string-case-action@v6
with:
string: ${{ github.repository }}
- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Push dev image to GitHub Packages
id: push_dev
uses: docker/build-push-action@v6
with:
context: .
file: Containerfile.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: Generate artifact attestation for dev image
# id: attest_dev
# uses: actions/attest-build-provenance@v2
# with:
# subject-name: ghcr.io/${{ steps.repository_name_conversion.outputs.lowercase }}/web-worker
# subject-digest: ${{ steps.push_dev.outputs.digest }}
# push-to-registry: true
- name: Push stable image to GitHub Packages
id: push_stable
uses: docker/build-push-action@v6
with:
context: .
file: Containerfile.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 }}
# - name: Generate artifact attestation for stable image
# id: attest_stable
# uses: actions/attest-build-provenance@v2
# with:
# subject-name: ghcr.io/${{ steps.repository_name_conversion.outputs.lowercase }}/web-worker-dev
# subject-digest: ${{ steps.push_stable.outputs.digest }}
# push-to-registry: true