Skip to content

Commit 98283c4

Browse files
committed
maintenance, added action to publish docker image
Signed-off-by: Alexander Piskun <[email protected]>
1 parent 12ec0f6 commit 98283c4

File tree

4 files changed

+120
-28
lines changed

4 files changed

+120
-28
lines changed
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
name: Publish CPU Image
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
push_to_registry:
8+
name: Build image
9+
runs-on: ubuntu-latest
10+
if: ${{ github.repository_owner == 'cloud-py-api' }}
11+
permissions:
12+
packages: write
13+
contents: read
14+
steps:
15+
- name: Set app env
16+
run: |
17+
# Split and keep last
18+
echo "APP_NAME=${GITHUB_REPOSITORY##*/}" >> $GITHUB_ENV
19+
echo "APP_VERSION=${GITHUB_REF##*/}" >> $GITHUB_ENV
20+
21+
- name: Checkout
22+
uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3
23+
with:
24+
path: ${{ env.APP_NAME }}
25+
26+
- name: Read package.json node and npm engines version
27+
uses: skjnldsv/read-package-engines-version-actions@0ce2ed60f6df073a62a77c0a4958dd0fc68e32e7 # v2.1
28+
id: versions
29+
# Continue if no package.json
30+
continue-on-error: true
31+
with:
32+
path: ${{ env.APP_NAME }}
33+
fallbackNode: "^20"
34+
fallbackNpm: "^10"
35+
36+
- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
37+
# Skip if no package.json
38+
if: ${{ steps.versions.outputs.nodeVersion }}
39+
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3
40+
with:
41+
node-version: ${{ steps.versions.outputs.nodeVersion }}
42+
43+
- name: Set up npm ${{ steps.versions.outputs.npmVersion }}
44+
# Skip if no package.json
45+
if: ${{ steps.versions.outputs.npmVersion }}
46+
run: npm i -g npm@"${{ steps.versions.outputs.npmVersion }}"
47+
48+
- name: Build ${{ env.APP_NAME }}
49+
# Skip if no package.json
50+
if: ${{ steps.versions.outputs.nodeVersion }}
51+
run: |
52+
cd ${{ env.APP_NAME }}
53+
npm ci
54+
npm run build
55+
56+
- name: Set up QEMU
57+
uses: docker/setup-qemu-action@v3
58+
- name: Set up Docker Buildx
59+
uses: docker/setup-buildx-action@v3
60+
61+
- name: Log in to GitHub Container Registry
62+
uses: docker/login-action@v3
63+
with:
64+
registry: ghcr.io
65+
username: ${{ github.actor }}
66+
password: ${{ secrets.GITHUB_TOKEN }}
67+
68+
- name: Available platforms
69+
run: echo ${{ steps.buildx.outputs.platforms }}
70+
71+
- name: Install xmlstarlet
72+
run: sudo apt-get update && sudo apt-get install -y xmlstarlet
73+
74+
- name: Extract version from XML
75+
id: extract_version
76+
run: |
77+
cd ${{ env.APP_NAME }}
78+
VERSION=$(xmlstarlet sel -t -v "//image-tag" appinfo/info.xml)
79+
echo "VERSION=$VERSION" >> $GITHUB_ENV
80+
81+
- name: Log version
82+
run: |
83+
echo "Extracted version: ${{ env.VERSION }}"
84+
85+
- name: Build container image
86+
uses: docker/build-push-action@v5
87+
with:
88+
push: true
89+
context: ./${{ env.APP_NAME }}
90+
platforms: linux/amd64,linux/arm64
91+
tags: ghcr.io/cloud-py-api/${{ env.APP_NAME }}:${{ env.VERSION }}
92+
build-args: |
93+
BUILD_TYPE=cpu

.github/workflows/stale.yml

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,19 +2,18 @@ name: 'Close stale issues'
22

33
on:
44
schedule:
5-
- cron: '0 12 * * 0' # Every Sunday at 12:00 PM UTC
5+
- cron: '0 12 * * *'
66

77
jobs:
88
stale:
99
runs-on: ubuntu-latest
1010
steps:
1111
- uses: actions/stale@v9
1212
with:
13-
days-before-stale: 14
14-
days-before-close: 9
15-
days-before-pr-close: -1 # Never close PR's automatically
16-
any-of-labels: 'question, invalid'
17-
stale-issue-message: 'This issue did not receive an update in the last 4 weeks.
18-
Please take a look again and update the issue with new details,
19-
otherwise it will be automatically closed in 2 weeks. Thank you!'
20-
exempt-all-pr-milestones: true
13+
stale-issue-message: 'This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.'
14+
days-before-stale: 30
15+
days-before-close: 5
16+
days-before-pr-stale: -1
17+
days-before-pr-close: -1
18+
exempt-all-pr-assignees: true
19+
repo-token: ${{ secrets.GITHUB_TOKEN }}

Makefile

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -9,30 +9,24 @@ help:
99
@echo " "
1010
@echo " build-push build image and upload to ghcr.io"
1111
@echo " "
12-
@echo " run27 install Skeleton for Nextcloud 27"
1312
@echo " run28 install Skeleton for Nextcloud 28"
1413
@echo " run29 install Skeleton for Nextcloud 29"
14+
@echo " run30 install Skeleton for Nextcloud 30"
1515
@echo " run install Skeleton for Nextcloud Last"
1616
@echo " "
1717
@echo " For development of this example use PyCharm run configurations. Development is always set for last Nextcloud."
1818
@echo " First run 'Skeleton' and then 'make registerXX', after that you can use/debug/develop it and easy test."
1919
@echo " "
20-
@echo " register27 perform registration of running Skeleton into the 'manual_install' deploy daemon."
2120
@echo " register28 perform registration of running Skeleton into the 'manual_install' deploy daemon."
2221
@echo " register29 perform registration of running Skeleton into the 'manual_install' deploy daemon."
22+
@echo " register30 perform registration of running Skeleton into the 'manual_install' deploy daemon."
2323
@echo " register perform registration of running Skeleton into the 'manual_install' deploy daemon."
2424

2525
.PHONY: build-push
2626
build-push:
2727
docker login ghcr.io
2828
docker buildx build --push --platform linux/arm64/v8,linux/amd64 --tag ghcr.io/cloud-py-api/skeleton:latest .
2929

30-
.PHONY: run27
31-
run27:
32-
docker exec master-stable27-1 sudo -u www-data php occ app_api:app:unregister skeleton --silent --force || true
33-
docker exec master-stable27-1 sudo -u www-data php occ app_api:app:register skeleton --force-scopes \
34-
--info-xml https://raw.githubusercontent.com/cloud-py-api/app-skeleton-python/main/appinfo/info.xml
35-
3630
.PHONY: run28
3731
run28:
3832
docker exec master-stable28-1 sudo -u www-data php occ app_api:app:unregister skeleton --silent --force || true
@@ -45,36 +39,42 @@ run29:
4539
docker exec master-stable29-1 sudo -u www-data php occ app_api:app:register skeleton --force-scopes \
4640
--info-xml https://raw.githubusercontent.com/cloud-py-api/app-skeleton-python/main/appinfo/info.xml
4741

42+
.PHONY: run30
43+
run30:
44+
docker exec master-stable30-1 sudo -u www-data php occ app_api:app:unregister skeleton --silent --force || true
45+
docker exec master-stable30-1 sudo -u www-data php occ app_api:app:register skeleton --force-scopes \
46+
--info-xml https://raw.githubusercontent.com/cloud-py-api/app-skeleton-python/main/appinfo/info.xml
47+
4848
.PHONY: run
4949
run:
5050
docker exec master-nextcloud-1 sudo -u www-data php occ app_api:app:unregister skeleton --silent --force || true
5151
docker exec master-nextcloud-1 sudo -u www-data php occ app_api:app:register skeleton --force-scopes \
5252
--info-xml https://raw.githubusercontent.com/cloud-py-api/app-skeleton-python/main/appinfo/info.xml
5353

54-
.PHONY: register27
55-
register27:
56-
docker exec master-stable27-1 sudo -u www-data php occ app_api:app:unregister skeleton --silent --force || true
57-
docker exec master-stable27-1 sudo -u www-data php occ app_api:app:register skeleton manual_install --json-info \
58-
"{\"id\":\"skeleton\",\"name\":\"App Skeleton\",\"daemon_config_name\":\"manual_install\",\"version\":\"1.0.0\",\"secret\":\"12345\",\"port\":9030,\"scopes\":[],\"system\":0}" \
59-
--force-scopes --wait-finish
60-
6154
.PHONY: register28
6255
register28:
6356
docker exec master-stable28-1 sudo -u www-data php occ app_api:app:unregister skeleton --silent --force || true
6457
docker exec master-stable28-1 sudo -u www-data php occ app_api:app:register skeleton manual_install --json-info \
65-
"{\"id\":\"skeleton\",\"name\":\"App Skeleton\",\"daemon_config_name\":\"manual_install\",\"version\":\"1.0.0\",\"secret\":\"12345\",\"port\":9030,\"scopes\":[],\"system\":0}" \
58+
"{\"id\":\"skeleton\",\"name\":\"App Skeleton\",\"daemon_config_name\":\"manual_install\",\"version\":\"1.0.0\",\"secret\":\"12345\",\"port\":9030,\"scopes\":[]}" \
6659
--force-scopes --wait-finish
6760

6861
.PHONY: register29
6962
register29:
7063
docker exec master-stable29-1 sudo -u www-data php occ app_api:app:unregister skeleton --silent --force || true
7164
docker exec master-stable29-1 sudo -u www-data php occ app_api:app:register skeleton manual_install --json-info \
72-
"{\"id\":\"skeleton\",\"name\":\"App Skeleton\",\"daemon_config_name\":\"manual_install\",\"version\":\"1.0.0\",\"secret\":\"12345\",\"port\":9030,\"scopes\":[],\"system\":0}" \
65+
"{\"id\":\"skeleton\",\"name\":\"App Skeleton\",\"daemon_config_name\":\"manual_install\",\"version\":\"1.0.0\",\"secret\":\"12345\",\"port\":9030,\"scopes\":[]}" \
66+
--force-scopes --wait-finish
67+
68+
.PHONY: register30
69+
register30:
70+
docker exec master-stable30-1 sudo -u www-data php occ app_api:app:unregister skeleton --silent --force || true
71+
docker exec master-stable30-1 sudo -u www-data php occ app_api:app:register skeleton manual_install --json-info \
72+
"{\"id\":\"skeleton\",\"name\":\"App Skeleton\",\"daemon_config_name\":\"manual_install\",\"version\":\"1.0.0\",\"secret\":\"12345\",\"port\":9030,\"scopes\":[]}" \
7373
--force-scopes --wait-finish
7474

7575
.PHONY: register
7676
register:
7777
docker exec master-nextcloud-1 sudo -u www-data php occ app_api:app:unregister skeleton --silent --force || true
7878
docker exec master-nextcloud-1 sudo -u www-data php occ app_api:app:register skeleton manual_install --json-info \
79-
"{\"id\":\"skeleton\",\"name\":\"App Skeleton\",\"daemon_config_name\":\"manual_install\",\"version\":\"1.0.0\",\"secret\":\"12345\",\"port\":9030,\"scopes\":[],\"system\":0}" \
79+
"{\"id\":\"skeleton\",\"name\":\"App Skeleton\",\"daemon_config_name\":\"manual_install\",\"version\":\"1.0.0\",\"secret\":\"12345\",\"port\":9030,\"scopes\":[]}" \
8080
--force-scopes --wait-finish

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
nc_py_api[app]>=0.11.0
1+
nc_py_api[app]>=0.15.0

0 commit comments

Comments
 (0)