Skip to content

Commit 236ad54

Browse files
authored
Merge pull request #647 from linuxserver/code-server-powershell-update
code-server-powershell update/add workflows
2 parents 1031407 + 2826d17 commit 236ad54

File tree

6 files changed

+67
-99
lines changed

6 files changed

+67
-99
lines changed

.github/workflows/BuildImage.yml

Lines changed: 32 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,74 +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: "code-server" #replace
89
MODNAME: "powershell" #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-
# Set version
19-
PS_VERSION=$(curl -Ls -o /dev/null -w %{url_effective} https://aka.ms/powershell-release?tag=stable | sed 's|.*tag/v||g')
20-
echo "PS_VERSION=${PS_VERSION}" >> $GITHUB_ENV
21-
# Build image
22-
docker build --no-cache --build-arg PS_VERSION=${PS_VERSION} -t ${{ github.sha }} .
23-
24-
- name: Tag image
25-
if: ${{ github.ref == format('refs/heads/{0}-{1}', env.BASEIMAGE, env.MODNAME) }}
26-
run: |
27-
docker tag ${{ github.sha }} ${ENDPOINT}:${BASEIMAGE}-${MODNAME}
28-
docker tag ${{ github.sha }} ${ENDPOINT}:${BASEIMAGE}-${MODNAME}-${{ env.PS_VERSION }}
29-
docker tag ${{ github.sha }} ${ENDPOINT}:${BASEIMAGE}-${MODNAME}-${{ env.PS_VERSION }}-${{ github.sha }}
30-
docker tag ${{ github.sha }} ${ENDPOINT}:${BASEIMAGE}-${MODNAME}-${{ github.sha }}
31-
docker tag ${{ github.sha }} ghcr.io/${ENDPOINT}:${BASEIMAGE}-${MODNAME}
32-
docker tag ${{ github.sha }} ghcr.io/${ENDPOINT}:${BASEIMAGE}-${MODNAME}-${{ env.PS_VERSION }}
33-
docker tag ${{ github.sha }} ghcr.io/${ENDPOINT}:${BASEIMAGE}-${MODNAME}-${{ env.PS_VERSION }}-${{ github.sha }}
34-
docker tag ${{ github.sha }} ghcr.io/${ENDPOINT}:${BASEIMAGE}-${MODNAME}-${{ github.sha }}
35-
36-
- name: Credential check
37-
if: ${{ github.ref == format('refs/heads/{0}-{1}', env.BASEIMAGE, env.MODNAME) }}
38-
run: |
39-
echo "CR_USER=${{ secrets.CR_USER }}" >> $GITHUB_ENV
40-
echo "CR_PAT=${{ secrets.CR_PAT }}" >> $GITHUB_ENV
41-
echo "DOCKERUSER=${{ secrets.DOCKERUSER }}" >> $GITHUB_ENV
42-
echo "DOCKERPASS=${{ secrets.DOCKERPASS }}" >> $GITHUB_ENV
43-
if [[ "${{ secrets.CR_USER }}" == "" && "${{ secrets.CR_PAT }}" == "" && "${{ secrets.DOCKERUSER }}" == "" && "${{ secrets.DOCKERPASS }}" == "" ]]; then
44-
echo "::error::Push credential secrets missing."
45-
echo "::error::You must set either CR_USER & CR_PAT or DOCKERUSER & DOCKERPASS as secrets in your repo settings."
46-
echo "::error::See https://github.com/linuxserver/docker-mods/blob/master/README.md for more information/instructions."
47-
exit 1
48-
fi
49-
50-
- name: Login to GitHub Container Registry
51-
if: ${{ github.ref == format('refs/heads/{0}-{1}', env.BASEIMAGE, env.MODNAME) && env.CR_USER && env.CR_PAT }}
52-
run: |
53-
echo "${{ secrets.CR_PAT }}" | docker login ghcr.io -u ${{ secrets.CR_USER }} --password-stdin
54-
55-
- name: Push tags to GitHub Container Registry
56-
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
5717
run: |
58-
docker push ghcr.io/${ENDPOINT}:${BASEIMAGE}-${MODNAME}-${{ env.PS_VERSION }}
59-
docker push ghcr.io/${ENDPOINT}:${BASEIMAGE}-${MODNAME}-${{ env.PS_VERSION }}-${{ github.sha }}
60-
docker push ghcr.io/${ENDPOINT}:${BASEIMAGE}-${MODNAME}-${{ github.sha }}
61-
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 -Ls -o /dev/null -w %{url_effective} https://aka.ms/powershell-release?tag=stable | sed 's|.*tag/v||g')
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 }}
6231

63-
- name: Login to DockerHub
64-
if: ${{ github.ref == format('refs/heads/{0}-{1}', env.BASEIMAGE, env.MODNAME) && env.DOCKERUSER && env.DOCKERPASS }}
65-
run: |
66-
echo ${{ secrets.DOCKERPASS }} | docker login -u ${{ secrets.DOCKERUSER }} --password-stdin
67-
68-
- name: Push tags to DockerHub
69-
if: ${{ github.ref == format('refs/heads/{0}-{1}', env.BASEIMAGE, env.MODNAME) && env.DOCKERUSER && env.DOCKERPASS }}
70-
run: |
71-
docker push ${ENDPOINT}:${BASEIMAGE}-${MODNAME}-${{ env.PS_VERSION }}
72-
docker push ${ENDPOINT}:${BASEIMAGE}-${MODNAME}-${{ env.PS_VERSION }}-${{ github.sha }}
73-
docker push ${ENDPOINT}:${BASEIMAGE}-${MODNAME}-${{ github.sha }}
74-
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: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,24 @@
1-
FROM ghcr.io/linuxserver/baseimage-alpine:3.14 as buildstage
1+
# syntax=docker/dockerfile:1
22

3-
ARG PS_VERSION
3+
FROM ghcr.io/linuxserver/baseimage-alpine:3.17 as buildstage
4+
5+
ARG MOD_VERSION
46

57
RUN \
6-
apk add --no-cache \
7-
curl \
8-
jq && \
9-
if [ -z ${PS_VERSION+x} ]; then \
10-
PS_VERSION=$(curl -Ls -o /dev/null -w %{url_effective} https://aka.ms/powershell-release?tag=stable \
8+
if [ -z ${MOD_VERSION+x} ]; then \
9+
MOD_VERSION=$(curl -Ls -o /dev/null -w %{url_effective} https://aka.ms/powershell-release?tag=stable \
1110
| sed 's|.*tag/v||g'); \
1211
fi && \
1312
mkdir -p /root-layer/powershell && \
1413
curl -o \
1514
/root-layer/powershell/powershell_x86_64.tar.gz -L \
16-
"https://github.com/PowerShell/PowerShell/releases/download/v${PS_VERSION}/powershell-${PS_VERSION}-linux-x64.tar.gz" && \
15+
"https://github.com/PowerShell/PowerShell/releases/download/v${MOD_VERSION}/powershell-${MOD_VERSION}-linux-x64.tar.gz" && \
1716
curl -o \
1817
/root-layer/powershell/powershell_armv7l.tar.gz -L \
19-
"https://github.com/PowerShell/PowerShell/releases/download/v${PS_VERSION}/powershell-${PS_VERSION}-linux-arm32.tar.gz" && \
18+
"https://github.com/PowerShell/PowerShell/releases/download/v${MOD_VERSION}/powershell-${MOD_VERSION}-linux-arm32.tar.gz" && \
2019
curl -o \
2120
/root-layer/powershell/powershell_aarch64.tar.gz -L \
22-
"https://github.com/PowerShell/PowerShell/releases/download/v${PS_VERSION}/powershell-${PS_VERSION}-linux-arm64.tar.gz" && \
21+
"https://github.com/PowerShell/PowerShell/releases/download/v${MOD_VERSION}/powershell-${MOD_VERSION}-linux-arm64.tar.gz" && \
2322
echo "******** run basic test to validate tarballs *********" && \
2423
for i in x86_64 armv7l aarch64; do \
2524
mkdir -p "/tmp/${i}"; \

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

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

root/etc/cont-init.d/98-powershell

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

0 commit comments

Comments
 (0)