update
This commit is contained in:
26
.gitlab-ci.yml
Normal file
26
.gitlab-ci.yml
Normal file
@@ -0,0 +1,26 @@
|
||||
variables:
|
||||
script:
|
||||
description: "Which script to run?"
|
||||
value: ""
|
||||
- ""
|
||||
- "CreateRepos"
|
||||
|
||||
ProjectName:
|
||||
description: "Name of the Project (For CreateRepos)"
|
||||
|
||||
GITLAB_TOKEN:
|
||||
description: "Gitlab Token"
|
||||
|
||||
GITHUB_TOKEN:
|
||||
description: "Github token"
|
||||
|
||||
GITEA_TOKEN:
|
||||
description: "Gitea Token"
|
||||
|
||||
CreateRepos:
|
||||
image: mcr.microsoft.com/powershell:latest
|
||||
script:
|
||||
- pwsh -f ./scripts/gitlab-mirror.ps1 -ProjectName $ProjectName -GITLAB_TOKEN $GITLAB_TOKEN -GITHUB_TOKEN $GITHUB_TOKEN -GITEA_TOKEN $GITEA_TOKEN
|
||||
rules:
|
||||
- if: $script == "CreateRepos"
|
||||
- when: never
|
||||
@@ -1,4 +1,9 @@
|
||||
$ProjectName = Read-Host "What is the name of the project?"
|
||||
param(
|
||||
$ProjectName,
|
||||
$GITLAB_TOKEN,
|
||||
$GITHUB_TOKEN,
|
||||
$GITEA_TOKEN
|
||||
)
|
||||
|
||||
$gitlabDefaultHeaders = @{
|
||||
"PRIVATE-TOKEN" = $GITLAB_TOKEN
|
||||
@@ -7,6 +12,7 @@ $gitlabDefaultHeaders = @{
|
||||
$gitlabBaseURI = "https://gitlab.com/api/v4"
|
||||
|
||||
#Create Gitlab Repo
|
||||
Write-Host "Creating Gitlab Repo"
|
||||
$irm = @{
|
||||
uri = "$gitlabBaseURI/projects"
|
||||
headers = $gitlabDefaultHeaders
|
||||
@@ -21,6 +27,7 @@ $irm = @{
|
||||
$gitlabProject = Invoke-RestMethod @irm
|
||||
|
||||
#Create repos in github/gitea and add to gitlab mirror
|
||||
Write-Host "Creating Github and Gitea Repos"
|
||||
$repos = @(
|
||||
@{
|
||||
DefaultHeaders = @{
|
||||
Reference in New Issue
Block a user