Kuinka luoda ja käyttää paikallista Fedora-dokumentaation työnkulkua
Paikallisessa ympäristössä voit luoda tai muokata dokumenttejasi offline-tilassa. Käytät paikallista git-repositoriota, joka sisältää täydellisen joukon dokumentteja ja työkaluja muokkaustyökaluihin. Kun muokkaus on valmis, esikatsele ne paikallisessa Docs-sivujen versiossa. Se on ylivoimaisesti joustavin tapa työskennellä Docs-arkistojen kanssa, mikä on mahdollista laajan mukautuksen ansiosta yksilöllisiin työrutiineihin ja työvälineisiin. Paikallinen kirjoitusympäristö mahdollistaa täyden pääsyn kaikkiin resursseihin, joita käytät rutiininomaisesti työasemallasi, ja on siksi täysin mukautuva työskentelytyyliisi. Se sopii erityisen hyvin täysin uuden dokumentaatiokokonaisuuden luomiseen aiheesta tai olemassa olevan dokumentaatiokokonaisuuden tarkistamiseen. Tässä artikkelissa otetaan esimerkki Fedora-projektin arkistoista GitLabissa, mutta kokonaisprosessi voidaan kääntää Pagure- ja GitHub-projekteihin.
Edellytykset
-
Sinun täytyy täyttää perusvaatimukset, jotka on määritelty kohdassa Write contributions to Docs.
-
Työnkulku käyttää komentorivityökaluja useimmissa prosessin vaiheissa. Jonkin verran kokemusta Linux-terminaalilla työskentelystä on siksi tarpeen tai se täytyy oppia rinnakkain.
Tekijäympäristön luominen
Valmistelu
-
Käytä SSH-avaimia tunnistautuaksesi GitLab-etäpalvelimelle.
-
GPG-avain (gnu Privacy Guard) on allekirjoittaa vahvistetut kommentit.
GitLabissa mene Asetukset - Käyttäjäasetukset - Lisää SSH-avain / GPG-avain
Git ja Podman tulevat oletuksena Fedora-työasemalla. Podman-kontti asetetaan automaattisesti.
Create a local subdirectory where the clone of Docs repo is stored
Create the main directory with mkdir DirectoryName
$ mkdir ~/FedoraDocs
Set up the repository
Fork a project
In GitLab, go to the upstream repository and select the Fork button at the top. Select a namespace (your GitLab ID) and a visibility level for the forked project, which creates a fork to your GitLab account.
If you don’t have access to create a project, open an issue ticket in GitLab to create one for you.
Clone the repository
In your forked repo, select the blue Clone button drop-down, and then select Clone with SSH. Copy that link to your clipboard.
Go to your main docs directory, and clone the repo.
$ cd FedoraDocs
When cloning a repository, you can specify the new directory name as an additional argument. This creates a ContributorsGuide subdirectory and clones the repo into that directory.
$ git clone <GIT URL> ContributorsGuide
$ cd ContributorsGuide
Check the current branch, which is main or master.
$ git status
Show all branches on the remote.
$ git branch -v -a
To create a branch and switch to it,
$ git checkout -b <new-branch>
Working on content
Open the file(s) with your choice of text editor, edit, and save.
Sync your fork with the upstream repository
$ git remote -v
This will show the fork in your account as the origin.
Go to the upstream repo, and select the Clone button drop-down, and copy the Clone with SSH info.
$ git remote add upstream <SSH URL>
Run the command below to show both origin and upstream.
$ git remote -v
To keep your fork in sync with upstream,
$ git checkout main $ git fetch upstream
$ git pull upstream main
This command gets most recent commits from upstream to your local branch.
$ git push origin main
This command pushes your local commits to the main branch of the origin remote.
Run the scripts to preview locally
Go to the the directory where cloned repo is, and run the build scripts in terminal.
$ ./docsbuilder.sh
Preview in your browser using the address localhost:8080
Save your work
To see what has been going on with git add and git commit commands.
$ git status
To add changes which will be committed,
$ git add -A
Alternatively, to add all the files in the current working directory,
$ git add .
Prepare changes for upload, which will open text editor to add commit message.
$ git commit -s
The git log command displays the project history and specific changes.
$ git log
Push changes to your branch in your fork.
$ git push origin <branch-name>
Create merge requests
Go to your fork of the repository in GitLab.
On the left menu, click Merge Requests, and select the blue New merge request in the middle.
When you work in a fork, select your fork of the repository as the source branch.
In the Target branch dropdown list, select the branch from the upstream repository as the target branch.
Click Compare branches and continue.
Select Create merge request.
Want to help? Learn how to contribute to Fedora Docs ›