This repository has been archived by the owner on Apr 12, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
135 lines (125 loc) · 5.03 KB
/
push.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
name: push
on:
workflow_dispatch:
inputs:
release:
description: 'Publish release (untick for test only)'
default: 'true'
required: true
type: boolean
debian_version:
description: 'Debian version (buster vs buster-testing)'
default: 'buster'
required: true
type: string
#push:
# branches:
# - 'main'
jobs:
docker:
runs-on: ubuntu-latest
steps:
- name: Get package version
run: |
pip3 install htmlq
export changelog=$(curl "https://www.3cx.com/blog/change-log/phone-system-change-log/" --silent | htmlq "h2 + ul" -1)
export url=http://repo.3cx.com/3cx/dists/${{ github.event.inputs.debian_version }}/main/binary-amd64/Packages.gz
export package=3cxpbx
export package_version=$(curl -s $url | gunzip | grep -A 10 "^Package: $package$" | awk '/Version: / { print $2 }' | sort -r | head -1)
if [[ ! $(curl "https://www.3cx.com/blog/change-log/phone-system-change-log/" --silent | htmlq "h2" -1) == *"${package_version}"* ]]; then export changelog=""; fi
echo package_version=$package_version >> $GITHUB_ENV
echo changelog=$changelog >> $GITHUB_ENV
-
name: Checkout
uses: actions/checkout@v3
-
name: Set up QEMU
uses: docker/setup-qemu-action@v2
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
config: buildkitd.toml
-
name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.CR_PAT }}
-
name: Build and push (test)
uses: docker/build-push-action@v3
with:
context: .
push: true
build-args: |
PACKAGE_VERSION=${{ env.package_version }}
DEBIAN_VERSION=${{ github.event.inputs.debian_version }}
tags: |
ghcr.io/izer-xyz/3cx:${{ env.package_version }}-test-${{ github.run_number }}
ghcr.io/izer-xyz/3cx:${{ env.package_version }}-test
ghcr.io/izer-xyz/3cx:test
cache-from: type=gha
cache-to: type=gha,mode=max
-
name: Test image
timeout-minutes: 1
run: |
docker run -t --rm --env MODE=test --tmpfs /tmp --tmpfs /run --tmpfs /run/lock --cgroupns=host -v /sys/fs/cgroup:/sys/fs/cgroup:rw ghcr.io/izer-xyz/3cx:test
-
name: Build and push (release)
if: github.event.inputs.release == 'true'
uses: docker/build-push-action@v3
with:
context: .
platforms: linux/amd64, linux/arm64
#, linux/arm
push: true
build-args: |
PACKAGE_VERSION=${{ env.package_version }}
DEBIAN_VERSION=${{ github.event.inputs.debian_version }}
tags: |
ghcr.io/izer-xyz/3cx:${{ env.package_version }}-${{ github.run_number }}
ghcr.io/izer-xyz/3cx:${{ env.package_version }}
ghcr.io/izer-xyz/3cx:latest
${{ secrets.DOCKERHUB_USERNAME }}/3cx:latest
${{ secrets.DOCKERHUB_USERNAME }}/3cx:${{ env.package_version }}
${{ secrets.DOCKERHUB_USERNAME }}/3cx:${{ env.package_version }}-${{ github.run_number }}
-
name: Create Release
if: github.event.inputs.release == 'true'
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ env.package_version }}-${{ github.run_number }}
release_name: Release v${{ env.package_version }}-${{ github.run_number }}
body: |
3CX v${{ env.package_version }} docker image:
> docker run izerxyz/3cx:${{ env.package_version }}
Changelog:
${{ env.changelog }}
https://www.3cx.com/blog/change-log/phone-system-change-log/
-
name: Create TestRelease
if: github.event.inputs.release == 'false'
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ env.package_version }}-test-${{ github.run_number }}
release_name: Pre-release v${{ env.package_version }}-test-${{ github.run_number }}
prerelease: true
body: |
3CX v${{ env.package_version }}-test docker image:
> docker run ghcr.io/izer-xyz/3cx:${{ env.package_version }}-test
Changelog:
${{ env.changelog }}
https://www.3cx.com/blog/change-log/phone-system-change-log/