Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit 9323a8e

Browse files
committed
Update workflows
1 parent d7cc872 commit 9323a8e

13 files changed

+183
-242
lines changed

.github/CONTRIBUTING.md

100644100755
Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
# Contributing to omada-controller
1+
# Contributing to invoiceninja
22

33
## Gotchas
44

55
* While contributing make sure to make all your changes before creating a Pull Request, as our pipeline builds each commit after the PR is open.
66
* Read, and fill the Pull Request template
7-
* If this is a fix for a typo (in code, documentation, or the README) please file an issue and let us sort it out. We do not need a PR
7+
* If this is a fix for a typo in code or documentation in the README please file an issue
88
* If the PR is addressing an existing issue include, closes #\<issue number>, in the body of the PR commit message
99
* If you want to discuss changes, you can also bring it up in [#dev-talk](https://discordapp.com/channels/354974912613449730/757585807061155840) in our [Discord server](https://discord.gg/YWrKVTn)
1010

@@ -24,10 +24,10 @@
2424
## Readme
2525

2626
If you would like to change our readme, please __**do not**__ directly edit the readme, as it is auto-generated on each commit.
27-
Instead edit the [readme-vars.yml](https://github.com/linuxserver/docker-omada-controller/edit/master/readme-vars.yml).
27+
Instead edit the [readme-vars.yml](https://github.com/linuxserver/docker-invoiceninja/edit/master/readme-vars.yml).
2828

2929
These variables are used in a template for our [Jenkins Builder](https://github.com/linuxserver/docker-jenkins-builder) as part of an ansible play.
30-
Most of these variables are also carried over to [docs.linuxserver.io](https://docs.linuxserver.io/images/docker-omada-controller)
30+
Most of these variables are also carried over to [docs.linuxserver.io](https://docs.linuxserver.io/images/docker-invoiceninja)
3131

3232
### Fixing typos or clarify the text in the readme
3333

@@ -96,26 +96,25 @@ If you are proposing additional packages to be added, ensure that you added the
9696

9797
### Testing your changes
9898

99-
```bash
100-
git clone https://github.com/linuxserver/docker-omada-controller.git
101-
cd docker-omada-controller
99+
```
100+
git clone https://github.com/linuxserver/docker-invoiceninja.git
101+
cd docker-invoiceninja
102102
docker build \
103103
--no-cache \
104104
--pull \
105-
-t linuxserver/omada-controller:latest .
105+
-t linuxserver/invoiceninja:latest .
106106
```
107107
108108
The ARM variants can be built on x86_64 hardware using `multiarch/qemu-user-static`
109-
110-
```bash
109+
```
111110
docker run --rm --privileged multiarch/qemu-user-static:register --reset
112111
```
113112
114113
Once registered you can define the dockerfile to use with `-f Dockerfile.aarch64`.
115114
116-
## Update the changelog
115+
## Update the chagelog
117116
118-
If you are modifying the Dockerfiles or any of the startup scripts in [root](https://github.com/linuxserver/docker-omada-controller/tree/master/root), add an entry to the changelog
117+
If you are modifying the Dockerfiles or any of the startup scripts in [root](https://github.com/linuxserver/docker-invoiceninja/tree/master/root), add an entry to the changelog
119118
120119
```yml
121120
changelogs:

.github/FUNDING.yml

100644100755
File mode changed.

.github/ISSUE_TEMPLATE/config.yml

100644100755
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ contact_links:
99
about: Post on our community forum.
1010

1111
- name: Documentation
12-
url: https://docs.linuxserver.io/images/docker-omada-controller
12+
url: https://docs.linuxserver.io/images/docker-invoiceninja
1313
about: Documentation - information about all of our containers.

.github/ISSUE_TEMPLATE/issue.bug.md

100644100755
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,4 @@ about: Create a report to help us improve
3737
<!--- Provide your docker create/run command or compose yaml snippet, or a screenshot of settings if using a gui to create the container -->
3838

3939
## Docker logs
40-
<!--- Provide a full docker log, output of "docker logs omada-controller" -->
40+
<!--- Provide a full docker log, output of "docker logs invoiceninja" -->

.github/ISSUE_TEMPLATE/issue.feature.md

100644100755
File mode changed.

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<!--- Before submitting a pull request please check the following -->
88

9-
<!--- If this is a fix for a typo (in code, documentation, or the README) please file an issue and let us sort it out. We do not need a PR -->
9+
<!--- If this is a fix for a typo in code or documentation in the README please file an issue and let us sort it out we do not need a PR -->
1010
<!--- Ask yourself if this modification is something the whole userbase will benefit from, if this is a specific change for corner case functionality or plugins please look at making a Docker Mod or local script https://blog.linuxserver.io/2019/09/14/customizing-our-containers/ -->
1111
<!--- That if the PR is addressing an existing issue include, closes #<issue number> , in the body of the PR commit message -->
1212
<!--- You have included links to any files / patches etc your PR may be using in the body of the PR commit message -->
@@ -21,7 +21,7 @@
2121

2222
------------------------------
2323

24-
- [ ] I have read the [contributing](https://github.com/linuxserver/docker-omada-controller/blob/master/.github/CONTRIBUTING.md) guideline and understand that I have made the correct modifications
24+
- [ ] I have read the [contributing](https://github.com/linuxserver/docker-invoiceninja/blob/master/.github/CONTRIBUTING.md) guideline and understand that I have made the correct modifications
2525

2626
------------------------------
2727

.github/workflows/ci.yml

Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
name: CI
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- main
8+
pull_request:
9+
types:
10+
- opened
11+
- reopened
12+
schedule:
13+
- cron: '30 * * * *'
14+
15+
jobs:
16+
build:
17+
runs-on: ubuntu-latest
18+
if: "!contains(github.event.head_commit.message, '[ci-skip]')"
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v2
22+
23+
- name: Check if we should rebuild
24+
id: build_check
25+
run: |
26+
if [ "${{github.event_name}}" != "schedule" ]; then
27+
echo "**** event was not cron, rebuilding ****"
28+
echo ::set-output name=update_available::true
29+
exit 0
30+
fi
31+
32+
echo "**** Retrieving external version ****"
33+
EXT_RELEASE=$(curl -sL https://www.tp-link.com/uk/support/download/omada-software-controller/ | egrep -m 1 -o 'https?://[^ ]+.tar.gz' | awk -F "/" '{print $NF}' | awk -F '_' '{print $4}')
34+
if [ -z "${EXT_RELEASE}" ] || [ "${EXT_RELEASE}" == "null" ]; then
35+
echo "**** Can't retrieve external version, exiting ****"
36+
exit 1
37+
fi
38+
39+
EXT_RELEASE=$(echo ${EXT_RELEASE} | sed 's/[~,%@+;:/]//g')
40+
41+
echo "**** External version: ${EXT_RELEASE} ****"
42+
43+
echo "**** Retrieving last pushed version ****"
44+
45+
image="linuxserver-labs/omada-controller"
46+
tag="latest"
47+
token=$(curl -sX GET \
48+
"https://ghcr.io/token?scope=repository%3Alinuxserver-labs%2Fomada-controller%3Apull" \
49+
| jq -r '.token')
50+
multidigest=$(curl -s \
51+
--header "Accept: application/vnd.docker.distribution.manifest.v2+json" \
52+
--header "Authorization: Bearer ${token}" \
53+
"https://ghcr.io/v2/${image}/manifests/${tag}" \
54+
| jq -r 'first(.manifests[].digest)')
55+
digest=$(curl -s \
56+
--header "Accept: application/vnd.docker.distribution.manifest.v2+json" \
57+
--header "Authorization: Bearer ${token}" \
58+
"https://ghcr.io/v2/${image}/manifests/${multidigest}" \
59+
| jq -r '.config.digest')
60+
image_info=$(curl -sL \
61+
--header "Authorization: Bearer ${token}" \
62+
"https://ghcr.io/v2/${image}/blobs/${digest}" \
63+
| jq -r '.config')
64+
65+
IMAGE_RELEASE=$(echo ${image_info} | jq -r '.Labels.build_version' | awk '{print $3}')
66+
IMAGE_VERSION=$(echo ${IMAGE_RELEASE} | awk -F'-ls' '{print $1}')
67+
68+
if [ -z "${IMAGE_VERSION}" ]; then
69+
echo "**** Can't retrieve last pushed version, exiting ****"
70+
exit 1
71+
fi
72+
73+
echo "**** Last pushed version: ${IMAGE_VERSION} ****"
74+
75+
if [ "${EXT_RELEASE}" == "${IMAGE_VERSION}" ]; then
76+
echo "**** Version ${EXT_RELEASE} already pushed, not rebuilding ****"
77+
echo ::set-output name=update_available::false
78+
exit 0
79+
fi
80+
81+
echo ::set-output name=update_available::true
82+
83+
- name: Prepare
84+
id: prep
85+
run: |
86+
REGISTRY_IMAGE=$(echo "ghcr.io/$GITHUB_REPOSITORY" | sed 's/docker-//')
87+
VERSION=$(curl -sL https://www.tp-link.com/uk/support/download/omada-software-controller/ | egrep -m 1 -o 'https?://[^ ]+.tar.gz' | awk -F "/" '{print $NF}' | awk -F '_' '{print $4}')
88+
if [[ $GITHUB_REF == refs/tags/v* ]]; then
89+
VERSION=${GITHUB_REF#refs/tags/}
90+
fi
91+
92+
SEMVER=$(date '+%Y.%m.%d')
93+
semver_regex='([0-9]+)\.([0-9]+)\.([0-9]+)$'
94+
if [[ $VERSION =~ $semver_regex ]]; then
95+
SEMVER="${BASH_REMATCH[1]}.${BASH_REMATCH[2]}.${BASH_REMATCH[3]}"
96+
else
97+
semver_regex='([0-9]+)\.([0-9]+)(\.([0-9]+))?.*'
98+
if [[ $VERSION =~ $semver_regex ]]; then
99+
echo 'here'
100+
if [[ ${BASH_REMATCH[4]} ]]; then
101+
SEMVER="${BASH_REMATCH[1]}.${BASH_REMATCH[2]}.${BASH_REMATCH[4]}"
102+
else
103+
SEMVER="${BASH_REMATCH[1]}.${BASH_REMATCH[2]}.$(date '+%Y%m%d')"
104+
fi
105+
fi
106+
fi
107+
108+
TAGS="${REGISTRY_IMAGE}:${VERSION},${REGISTRY_IMAGE}:latest,${REGISTRY_IMAGE}:${SEMVER}"
109+
echo ::set-output name=tags::${TAGS}
110+
111+
if [ "${{github.event_name}}" == "pull_request" ]; then
112+
echo ::set-output name=push::false
113+
echo ::set-output name=cache_from::"type=registry,ref=${REGISTRY_IMAGE}:buildcache"
114+
echo ::set-output name=cache_to::""
115+
else
116+
echo ::set-output name=push::true
117+
echo ::set-output name=cache_from::"type=registry,ref=${REGISTRY_IMAGE}:buildcache"
118+
echo ::set-output name=cache_to::"type=registry,ref=${REGISTRY_IMAGE}:buildcache,mode=max"
119+
fi
120+
121+
echo ::set-output name=github_server_url::"${GITHUB_SERVER_URL}"
122+
echo ::set-output name=BUILD_DATE::$(date '+%Y-%m-%dT%H:%M:%S%:z')
123+
echo ::set-output name=VERSION::${VERSION}
124+
125+
- name: Set up QEMU
126+
uses: docker/setup-qemu-action@v1
127+
with:
128+
platforms: all
129+
130+
- name: Set up Docker Buildx
131+
id: buildx
132+
uses: docker/setup-buildx-action@v1
133+
with:
134+
install: true
135+
version: latest
136+
driver-opts: image=moby/buildkit:master
137+
138+
- name: Login to GitHub Container Registry
139+
if: github.event_name != 'pull_request'
140+
uses: docker/login-action@v1
141+
with:
142+
registry: ghcr.io
143+
username: linuxserver-labs
144+
password: ${{ secrets.GITHUB_TOKEN }}
145+
146+
- name: Build and Push
147+
id: docker_build
148+
if: ${{ steps.build_check.outputs.update_available == 'true' }}
149+
uses: docker/build-push-action@v2
150+
with:
151+
builder: ${{ steps.buildx.outputs.name }}
152+
context: .
153+
file: ./Dockerfile
154+
platforms: linux/amd64,linux/arm64
155+
push: ${{ steps.prep.outputs.push }}
156+
tags: ${{ steps.prep.outputs.tags }}
157+
build-args: |
158+
IMAGE_SOURCE=${{ steps.prep.outputs.github_server_url }}/${{ github.repository }}
159+
BUILD_DATE=${{ steps.prep.outputs.BUILD_DATE }}
160+
VERSION=${{ steps.prep.outputs.VERSION }}
161+
cache-from: ${{ steps.prep.outputs.cache_from }}
162+
cache-to: ${{ steps.prep.outputs.cache_to }}
163+
164+
- name: Image digest
165+
run: echo ${{ steps.docker_build.outputs.digest }}

.github/workflows/external_trigger.yml

Lines changed: 0 additions & 92 deletions
This file was deleted.

.github/workflows/external_trigger_scheduler.yml

Lines changed: 0 additions & 43 deletions
This file was deleted.

0 commit comments

Comments
 (0)