This repository has been archived by the owner on Jul 12, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FEATURE] RIT PUBLISH REPO (ENCAPSULATE GITHUB & GITLAB) (#163)
* merge master * resolve conflicts * merge upstream * formula implementation * formula files * formula files bis * Markdown lint * PRE COMMIT VALIDATION * Update README
- Loading branch information
1 parent
6d4e23a
commit 0966fb6
Showing
16 changed files
with
185 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
{ | ||
"execution": [ | ||
"local", | ||
"docker" | ||
"local" | ||
], | ||
"os": { | ||
"deps": [], | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
{ | ||
"execution": [ | ||
"local", | ||
"docker" | ||
"local" | ||
], | ||
"os": { | ||
"deps": [], | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"long": "Command to publish contents on any platform", | ||
"short": "Publish command" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
FROM cimg/base:stable-20.04 | ||
|
||
USER root | ||
|
||
RUN curl -fsSL https://commons-repo.ritchiecli.io/install.sh | bash | ||
|
||
RUN mkdir /rit | ||
COPY . /rit | ||
RUN sed -i 's/\r//g' /rit/set_umask.sh | ||
RUN sed -i 's/\r//g' /rit/run.sh | ||
RUN chmod +x /rit/set_umask.sh | ||
|
||
WORKDIR /app | ||
ENTRYPOINT ["/rit/set_umask.sh"] | ||
CMD ["/rit/run.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# SH | ||
BINARY_NAME=run.sh | ||
BIN_FOLDER=bin | ||
|
||
build: bash-build docker | ||
|
||
bash-build: | ||
mkdir -p $(BIN_FOLDER) | ||
cp -r src/* $(BIN_FOLDER) | ||
mv $(BIN_FOLDER)/main.sh $(BIN_FOLDER)/$(BINARY_NAME) | ||
chmod +x $(BIN_FOLDER)/$(BINARY_NAME) | ||
|
||
docker: | ||
cp Dockerfile set_umask.sh $(BIN_FOLDER) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
<!-- markdownlint-disable-file MD013 --> | ||
<!-- markdownlint-disable-file MD033 --> | ||
<!-- markdownlint-disable-file MD024 --> | ||
|
||
# Ritchie Publish Repo Formula | ||
|
||
## Command | ||
|
||
- Set GITHUB or GITLAB credentials ($ rit set credentials) with USERNAME, TOKEN & EMAIL. | ||
|
||
- This formula can currently only be executed locally on MacOs or Linux. | ||
|
||
## Command | ||
|
||
- Prompt | ||
|
||
```bash | ||
rit publish repo | ||
``` | ||
|
||
- Stdin | ||
|
||
```bash | ||
echo '{"provider":"Github","privacy":"true", "project_name":"ritchie-formulas-demo", "workspace_path":"/home/users/dennis/ritchie-formulas-local", "version":"v1.0.0"}' | rit publish repo --stdin | ||
``` | ||
|
||
## Description | ||
|
||
This publish command allows the user to create a Githab or Gitlab Ritchie formulas repository based on a local repository. | ||
|
||
It encapsulates the `rit github publish repo` and the `rit gitlab publish repo` formulas. | ||
|
||
Therefore, it also generates a release and add it to Ritchie repositories ($ rit add repo). | ||
If the repository already exists, it will commit the new code and generate the new release version informed, before updating Ritchie repositories ($ rit update repo). | ||
|
||
The user has to inform 5 different kinds of inputs: | ||
|
||
- the provider (Github or Gitlab) | ||
|
||
- the repository's privacy | ||
|
||
- the repository's name | ||
|
||
- the local repository path you wish to publish | ||
|
||
- the release version to generate | ||
|
||
## Demonstration | ||
|
||
- Command execution | ||
|
||
<img class="special-img-class" src="/publish/repo/docs/img/Github.png" /> | ||
|
||
<img class="special-img-class" src="/publish/repo/docs/img/Gitlab.png" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
{ | ||
"dockerImageBuilder": "cimg/base:stable-20.04", | ||
"inputs": [ | ||
{ | ||
"items": [ | ||
"Github", | ||
"Gitlab" | ||
], | ||
"label": "Provider : ", | ||
"name": "provider", | ||
"type": "text" | ||
}, | ||
{ | ||
"cache": { | ||
"active": true, | ||
"newLabel": "Type new value. ", | ||
"qty": 6 | ||
}, | ||
"label": "Project Name : ", | ||
"name": "project_name", | ||
"type": "text" | ||
}, | ||
{ | ||
"default": "true", | ||
"items": [ | ||
"true", | ||
"false" | ||
], | ||
"label": "Will it be a private repository? ", | ||
"name": "privacy", | ||
"type": "text" | ||
}, | ||
{ | ||
"label": "Workspace to publish path: (ex: /home/user/dennis/ritchie-formulas)", | ||
"name": "workspace_path", | ||
"type": "text" | ||
}, | ||
{ | ||
"default": "v1.0.0", | ||
"label": "Version: (default: v1.0.0)", | ||
"name": "version", | ||
"type": "text" | ||
} | ||
] | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"long": "Publish formula repository on Github or Gitlab using rit github/gitlab publish repo formulas", | ||
"short": "Publish formula repository on Github or Gitlab" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"execution": [ | ||
"local" | ||
], | ||
"os": { | ||
"deps": [], | ||
"support": [ | ||
"mac", | ||
"linux" | ||
] | ||
}, | ||
"tags": [ | ||
"github", | ||
"gitlab", | ||
"publish", | ||
"repo" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/sh | ||
umask 0011 | ||
$1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/bash | ||
# shellcheck disable=SC2181 | ||
# shellcheck disable=SC2086 | ||
# shellcheck disable=SC2164 | ||
|
||
runFormula() { | ||
if [ "Github" == $PROVIDER ] | ||
then | ||
echo "🐙 Github provider selected" | ||
echo '{"privacy":"'$PRIVACY'", "project_name":"'$PROJECT_NAME'", "workspace_path":"'$WORKSPACE_PATH'", "version":"'$VERSION'"}' | rit github publish repo --stdin | ||
elif [ "Gitlab" == $PROVIDER ] | ||
then | ||
echo "🦊 Gitlab provider selected" | ||
echo '{"privacy":"'$PRIVACY'", "project_name":"'$PROJECT_NAME'", "workspace_path":"'$WORKSPACE_PATH'", "version":"'$VERSION'"}' | rit gitlab publish repo --stdin | ||
else | ||
echo "🤖 Unexpected Provider informed. Check it please and try again." | ||
fi | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/bash | ||
|
||
# shellcheck source=/dev/null | ||
. "$(dirname "$0")"/formula/formula.sh --source-only | ||
|
||
runFormula |