Skip to content

Commit dfd7747

Browse files
Merge pull request #155 from nextcloud/feat/noid/add-script-for-gmbh
feat(repo): Add script for gmbh forks
2 parents b28214b + e836c52 commit dfd7747

3 files changed

Lines changed: 142 additions & 0 deletions

File tree

setup-fork-repository/README.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Creating a fork repository
2+
3+
## nextcloud-gmbh
4+
5+
1. 🛑 Do not **fork** the public repository ☣️
6+
2. Create the repository: https://github.com/organizations/nextcloud-gmbh/repositories/new
7+
- Name: *Exact same name as on https://github.com/nextcloud/*
8+
- Visibility: `Private`
9+
- Template: `No template`
10+
- Add Readme: `Off`
11+
- Add .gitignore: `No .gitignore`
12+
- Add license: `None`
13+
3. Run `./setup-gmbh-repository.sh <repo-name>`
14+
4. Settings > Collaborators and teams:
15+
16+
Grant `Role: maintainer` to the respective GitHub team or user
17+
18+
## nextcloud-releases
19+
20+
1. Create the repository: https://github.com/organizations/nextcloud-releases/repositories/new
21+
- Name: *Exact same name as on https://github.com/nextcloud/*
22+
- Visibility: `Public`
23+
- Template: `No template`
24+
- Add Readme: `Off`
25+
- Add .gitignore: `No .gitignore`
26+
- Add license: `None`
27+
2. Run `./setup-release-repository.sh <repo-name>`
28+
3. Settings > Collaborators and teams:
29+
30+
Grant `Role: maintainer` to the respective GitHub team or user
31+
32+
4. Settings > Secrets and variables > Actions:
33+
34+
Create a new **Repository secrets** named `APP_PRIVATE_KEY` with the apps private key or ask a team member with admin permissions to do that
35+
36+
5. Add the `nextcloud_release_service` user as co-maintainer of the app on https://apps.nextcloud.com/
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
#!/usr/bin/env bash
2+
#
3+
4+
GIT=$(which "git")
5+
6+
if [ -x "$GIT" ]; then
7+
echo "Using git executable $GIT"
8+
else
9+
echo "Could not find git executable $GIT" >&2
10+
exit 1
11+
fi
12+
13+
GITHUB_CLI=$(which "gh")
14+
15+
if [ -x "$GITHUB_CLI" ]; then
16+
echo "Using Microsoft GitHub CLI executable $GITHUB_CLI"
17+
fi
18+
19+
APP_ID=$1
20+
if [ "$APP_ID" ]; then
21+
echo "Preparing app $APP_ID"
22+
else
23+
echo "Missing app id" >&2
24+
exit 1
25+
fi
26+
27+
ORIGINAL_DIR=$(pwd)
28+
WORK_DIR=$(mktemp -d)
29+
cd "${WORK_DIR}"
30+
31+
$GIT clone https://github.com/nextcloud-gmbh/$APP_ID.git
32+
33+
cd $APP_ID
34+
$GIT remote set-url --push origin git@github.com:nextcloud-gmbh/$APP_ID.git
35+
36+
$GIT checkout --orphan gmbh-main
37+
38+
cat > README.md<<'EOF'
39+
# $APP_ID
40+
41+
This repository is a clone of https://github.com/nextcloud/$APP_ID
42+
This branch is empty and contains information related to this repo.
43+
44+
You can find the main and other stable branches here:
45+
- https://github.com/nextcloud-gmbh/$APP_ID/tree/main
46+
- https://github.com/nextcloud-gmbh/$APP_ID/branches
47+
48+
EOF
49+
$GIT add README.md
50+
$GIT commit -m "Init readme"
51+
$GIT push origin gmbh-main
52+
53+
$GIT checkout -b activate-actions
54+
mkdir -p .github/workflows/
55+
cat > .github/workflows/blank.yml<<'EOF'
56+
# This is a basic workflow to help you get started with Actions
57+
58+
name: CI
59+
60+
# Controls when the workflow will run
61+
on:
62+
# Triggers the workflow on push or pull request events but only for the main2 branch
63+
push:
64+
branches: [ 'gmbh-main' ]
65+
pull_request:
66+
branches: [ 'gmbh-main' ]
67+
68+
# Allows you to run this workflow manually from the Actions tab
69+
workflow_dispatch:
70+
71+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
72+
jobs:
73+
# This workflow contains a single job called "build"
74+
build:
75+
# The type of runner that the job will run on
76+
runs-on: ubuntu-latest
77+
78+
# Steps represent a sequence of tasks that will be executed as part of the job
79+
steps:
80+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
81+
- uses: actions/checkout@v2
82+
83+
# Runs a single command using the runners shell
84+
- name: Run a one-line script
85+
run: echo Hello, world!
86+
87+
# Runs a set of commands using the runners shell
88+
- name: Run a multi-line script
89+
run: |
90+
echo Add other actions to build,
91+
echo test, and deploy your project.
92+
EOF
93+
94+
$GIT add .github/workflows/blank.yml
95+
$GIT commit -m "Activate github actions with a trick"
96+
$GIT push --set-upstream origin $($GIT symbolic-ref --short HEAD)
97+
98+
if [ -x "$GITHUB_CLI" ]; then
99+
$GITHUB_CLI pr create --base gmbh-main --fill
100+
$GIT push --delete origin activate-actions
101+
else
102+
xdg-open "https://github.com/nextcloud-gmbh/${APP_ID}/pull/new/activate-actions" 2>/dev/null
103+
fi
104+
105+
cd "${ORIGINAL_DIR}"
106+
rm -Rf "${WORK_DIR}"
File renamed without changes.

0 commit comments

Comments
 (0)