-
Notifications
You must be signed in to change notification settings - Fork 4
186 lines (167 loc) · 5.54 KB
/
docker-publish.yml
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
name: Docker
on:
release:
types:
- published
push:
branches:
- master
tags: '*'
paths:
- Dockerfile
- cronitor.py
- entrypoint.sh
- release
- beta-release
- .github/workflows/docker-publish.yml
pull_request:
types:
- opened
- synchronize
paths:
- Dockerfile
- cronitor.py
- entrypoint.sh
- release
- beta-release
- .github/workflows/docker-publish.yml
# Define environment variables
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
codeql:
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.11
- uses: github/codeql-action/init@v3
with:
languages: python
- uses: github/codeql-action/autobuild@v3
- uses: github/codeql-action/analyze@v3
build-stable:
if: |
github.repository == '${{ github.repository }}' &&
(
github.event_name == 'push' ||
github.event_name == 'release' ||
(github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]')
)
needs: [codeql]
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log into registry ${{ env.REGISTRY }}
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: groenator
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
flavor: |
latest=${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }}
images: |
ghcr.io/groenator/iptvboss-docker
tags: |
type=ref,event=pr
type=semver,pattern=v{{major}}.{{minor}}.{{patch}}
type=semver,pattern=v{{major}}.{{minor}}
type=semver,pattern=v{{major}},enable=${{ !startsWith(github.ref, 'refs/tags/v') }}
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }}
- name: Set release tag as environment variable
id: set-tag
run: |
echo -e "LATEST_TAG=$(cat release)" >> $GITHUB_ENV
# Build and push Stable Image
- name: Short commit
id: shortcommit
run: echo "{name}={value}::$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Build and push final image
uses: docker/build-push-action@v5
with:
platforms: linux/amd64,linux/arm64
labels: ${{ steps.meta.outputs.labels }}
build-args: |
LATEST_TAG=${{ steps.set-tag.outputs.LATEST_TAG }}
tags: ${{ steps.meta.outputs.tags }}
push: true
context: .
- name: Clean Buildx Cache
run: docker buildx prune -f --all
build-beta:
if: |
github.repository == '${{ github.repository }}' &&
(
github.event_name == 'push' ||
github.event_name == 'release' ||
(github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository && github.actor != 'dependabot[bot]')
)
needs: [codeql]
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log into registry ${{ env.REGISTRY }}
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: groenator
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v5
with:
flavor: |
latest=${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }}
images: |
ghcr.io/groenator/iptvboss-docker-beta
tags: |
type=ref,event=pr
type=semver,pattern=v{{major}}.{{minor}}.{{patch}}
type=semver,pattern=v{{major}}.{{minor}}
type=semver,pattern=v{{major}},enable=${{ !startsWith(github.ref, 'refs/tags/v') }}
type=raw,value=latest,enable=${{ github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }}
- name: Set release tag as environment variable
id: set-tag
run: |
echo -e "BETA_TAG=$(cat beta-release)" >> $GITHUB_ENV
# Build and push Beta Image
- name: Short commit
id: shortcommit
run: echo "{name}={value}::$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Build and push final image
uses: docker/build-push-action@v5
with:
platforms: linux/amd64,linux/arm64
labels: ${{ steps.meta.outputs.labels }}
build-args: |
BETA_TAG=${{ steps.set-tag.outputs.BETA_TAG }}
tags: |
ghcr.io/groenator/iptvboss-docker-beta:${{ steps.set-tag.outputs.BETA_TAG }}
push: true
context: .
- name: Clean Buildx Cache
run: docker buildx prune -f --all