Skip to content

Commit e88fd69

Browse files
authored
Merge pull request #691 from linuxserver/universal-cloudflared-update
universal-cloudflared update/add workflows
2 parents af7cf70 + c19a967 commit e88fd69

File tree

7 files changed

+63
-212
lines changed

7 files changed

+63
-212
lines changed

.github/workflows/BuildImage.yml

Lines changed: 32 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,72 +1,45 @@
11
name: Build Image
22

3-
on: [push, pull_request, workflow_dispatch]
3+
on: [push, pull_request_target, workflow_dispatch]
44

55
env:
6+
GITHUB_REPO: "linuxserver/docker-mods" #don't modify
67
ENDPOINT: "linuxserver/mods" #don't modify
78
BASEIMAGE: "universal" #replace
89
MODNAME: "cloudflared" #replace
910

1011
jobs:
11-
build:
12+
set-vars:
1213
runs-on: ubuntu-latest
1314
steps:
14-
- uses: actions/[email protected]
15-
16-
- name: Build image
17-
run: |
18-
CLOUDFLARED_TAG=$(curl -s https://api.github.com/repos/cloudflare/cloudflared/releases/latest | jq -rc ".tag_name")
19-
echo "CLOUDFLARED_TAG=${CLOUDFLARED_TAG}" >> $GITHUB_ENV
20-
docker build --no-cache --build-arg CLOUDFLARED_TAG=${CLOUDFLARED_TAG} -t ${{ github.sha }} .
21-
22-
- name: Tag image
23-
if: ${{ github.ref == format('refs/heads/{0}-{1}', env.BASEIMAGE, env.MODNAME) }}
24-
run: |
25-
docker tag ${{ github.sha }} ${ENDPOINT}:${BASEIMAGE}-${MODNAME}
26-
docker tag ${{ github.sha }} ${ENDPOINT}:${BASEIMAGE}-${MODNAME}-${CLOUDFLARED_TAG}
27-
docker tag ${{ github.sha }} ${ENDPOINT}:${BASEIMAGE}-${MODNAME}-${CLOUDFLARED_TAG}-${{ github.sha }}
28-
docker tag ${{ github.sha }} ${ENDPOINT}:${BASEIMAGE}-${MODNAME}-${{ github.sha }}
29-
docker tag ${{ github.sha }} ghcr.io/${ENDPOINT}:${BASEIMAGE}-${MODNAME}
30-
docker tag ${{ github.sha }} ghcr.io/${ENDPOINT}:${BASEIMAGE}-${MODNAME}-${CLOUDFLARED_TAG}
31-
docker tag ${{ github.sha }} ghcr.io/${ENDPOINT}:${BASEIMAGE}-${MODNAME}-${CLOUDFLARED_TAG}-${{ github.sha }}
32-
docker tag ${{ github.sha }} ghcr.io/${ENDPOINT}:${BASEIMAGE}-${MODNAME}-${{ github.sha }}
33-
34-
- name: Credential check
35-
if: ${{ github.ref == format('refs/heads/{0}-{1}', env.BASEIMAGE, env.MODNAME) }}
36-
run: |
37-
echo "CR_USER=${{ secrets.CR_USER }}" >> $GITHUB_ENV
38-
echo "CR_PAT=${{ secrets.CR_PAT }}" >> $GITHUB_ENV
39-
echo "DOCKERUSER=${{ secrets.DOCKERUSER }}" >> $GITHUB_ENV
40-
echo "DOCKERPASS=${{ secrets.DOCKERPASS }}" >> $GITHUB_ENV
41-
if [[ "${{ secrets.CR_USER }}" == "" && "${{ secrets.CR_PAT }}" == "" && "${{ secrets.DOCKERUSER }}" == "" && "${{ secrets.DOCKERPASS }}" == "" ]]; then
42-
echo "::error::Push credential secrets missing."
43-
echo "::error::You must set either CR_USER & CR_PAT or DOCKERUSER & DOCKERPASS as secrets in your repo settings."
44-
echo "::error::See https://github.com/linuxserver/docker-mods/blob/master/README.md for more information/instructions."
45-
exit 1
46-
fi
47-
48-
- name: Login to GitHub Container Registry
49-
if: ${{ github.ref == format('refs/heads/{0}-{1}', env.BASEIMAGE, env.MODNAME) && env.CR_USER && env.CR_PAT }}
50-
run: |
51-
echo "${{ secrets.CR_PAT }}" | docker login ghcr.io -u ${{ secrets.CR_USER }} --password-stdin
52-
53-
- name: Push tags to GitHub Container Registry
54-
if: ${{ github.ref == format('refs/heads/{0}-{1}', env.BASEIMAGE, env.MODNAME) && env.CR_USER && env.CR_PAT }}
15+
- name: Set Vars
16+
id: outputs
5517
run: |
56-
docker push ghcr.io/${ENDPOINT}:${BASEIMAGE}-${MODNAME}-${{ github.sha }}
57-
docker push ghcr.io/${ENDPOINT}:${BASEIMAGE}-${MODNAME}-${CLOUDFLARED_TAG}-${{ github.sha }}
58-
docker push ghcr.io/${ENDPOINT}:${BASEIMAGE}-${MODNAME}-${CLOUDFLARED_TAG}
59-
docker push ghcr.io/${ENDPOINT}:${BASEIMAGE}-${MODNAME}
18+
echo "GITHUB_REPO=${{ env.GITHUB_REPO }}" >> $GITHUB_OUTPUT
19+
echo "ENDPOINT=${{ env.ENDPOINT }}" >> $GITHUB_OUTPUT
20+
echo "BASEIMAGE=${{ env.BASEIMAGE }}" >> $GITHUB_OUTPUT
21+
echo "MODNAME=${{ env.MODNAME }}" >> $GITHUB_OUTPUT
22+
# **** If the mod needs to be versioned, set the versioning logic below. Otherwise leave as is. ****
23+
MOD_VERSION=$(curl -s https://api.github.com/repos/cloudflare/cloudflared/releases/latest | jq -rc ".tag_name")
24+
echo "MOD_VERSION=${MOD_VERSION}" >> $GITHUB_OUTPUT
25+
outputs:
26+
GITHUB_REPO: ${{ steps.outputs.outputs.GITHUB_REPO }}
27+
ENDPOINT: ${{ steps.outputs.outputs.ENDPOINT }}
28+
BASEIMAGE: ${{ steps.outputs.outputs.BASEIMAGE }}
29+
MODNAME: ${{ steps.outputs.outputs.MODNAME }}
30+
MOD_VERSION: ${{ steps.outputs.outputs.MOD_VERSION }}
6031

61-
- name: Login to DockerHub
62-
if: ${{ github.ref == format('refs/heads/{0}-{1}', env.BASEIMAGE, env.MODNAME) && env.DOCKERUSER && env.DOCKERPASS }}
63-
run: |
64-
echo ${{ secrets.DOCKERPASS }} | docker login -u ${{ secrets.DOCKERUSER }} --password-stdin
65-
66-
- name: Push tags to DockerHub
67-
if: ${{ github.ref == format('refs/heads/{0}-{1}', env.BASEIMAGE, env.MODNAME) && env.DOCKERUSER && env.DOCKERPASS }}
68-
run: |
69-
docker push ${ENDPOINT}:${BASEIMAGE}-${MODNAME}-${{ github.sha }}
70-
docker push ${ENDPOINT}:${BASEIMAGE}-${MODNAME}-${CLOUDFLARED_TAG}-${{ github.sha }}
71-
docker push ${ENDPOINT}:${BASEIMAGE}-${MODNAME}-${CLOUDFLARED_TAG}
72-
docker push ${ENDPOINT}:${BASEIMAGE}-${MODNAME}
32+
build:
33+
uses: linuxserver/github-workflows/.github/workflows/docker-mod-builder.yml@v1
34+
needs: set-vars
35+
secrets:
36+
CR_USER: ${{ secrets.CR_USER }}
37+
CR_PAT: ${{ secrets.CR_PAT }}
38+
DOCKERUSER: ${{ secrets.DOCKERUSER }}
39+
DOCKERPASS: ${{ secrets.DOCKERPASS }}
40+
with:
41+
GITHUB_REPO: ${{ needs.set-vars.outputs.GITHUB_REPO }}
42+
ENDPOINT: ${{ needs.set-vars.outputs.ENDPOINT }}
43+
BASEIMAGE: ${{ needs.set-vars.outputs.BASEIMAGE }}
44+
MODNAME: ${{ needs.set-vars.outputs.MODNAME }}
45+
MOD_VERSION: ${{ needs.set-vars.outputs.MOD_VERSION }}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Issue & PR Tracker
2+
3+
on:
4+
issues:
5+
types: [opened,reopened,labeled,unlabeled,closed]
6+
pull_request_target:
7+
types: [opened,reopened,review_requested,review_request_removed,labeled,unlabeled,closed]
8+
pull_request_review:
9+
types: [submitted,edited,dismissed]
10+
11+
jobs:
12+
manage-project:
13+
permissions:
14+
issues: write
15+
uses: linuxserver/github-workflows/.github/workflows/issue-pr-tracker.yml@v1
16+
secrets: inherit

.github/workflows/permissions.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
name: Permission check
2+
on:
3+
pull_request_target:
4+
paths:
5+
- '**/run'
6+
- '**/finish'
7+
- '**/check'
8+
jobs:
9+
permission_check:
10+
uses: linuxserver/github-workflows/.github/workflows/init-svc-executable-permissions.yml@v1

Dockerfile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1+
# syntax=docker/dockerfile:1
2+
13
# Build container
24
FROM ghcr.io/linuxserver/baseimage-alpine:3.17 AS buildstage
35

4-
ARG CLOUDFLARED_TAG
6+
ARG MOD_VERSION
57

68
RUN mkdir -p /root-layer/cloudflared
79
WORKDIR /src
@@ -16,12 +18,12 @@ ENV GO111MODULE=on \
1618
CGO_ENABLED=0
1719

1820
RUN \
19-
if [ -z "${CLOUDFLARED_TAG}" ]; then \
21+
if [ -z "${MOD_VERSION}" ]; then \
2022
curl -s https://api.github.com/repos/cloudflare/cloudflared/releases/latest \
2123
| jq -rc ".tag_name" \
2224
| xargs -I TAG sh -c 'git -c advice.detachedHead=false clone https://github.com/cloudflare/cloudflared --depth=1 --branch TAG .'; \
2325
else \
24-
git -c advice.detachedHead=false clone https://github.com/cloudflare/cloudflared --depth=1 --branch ${CLOUDFLARED_TAG} .; \
26+
git -c advice.detachedHead=false clone https://github.com/cloudflare/cloudflared --depth=1 --branch ${MOD_VERSION} .; \
2527
fi
2628

2729
RUN GOOS=linux GOARCH=amd64 make cloudflared

root/etc/cont-init.d/95-apt-get

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

root/etc/cont-init.d/98-cloudflared-config

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

root/etc/services.d/cloudflared/run

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

0 commit comments

Comments
 (0)