Kuinka luoda ja käyttää paikallista Fedora-dokumentaation työnkulkua

Fedora Documentation Team Last review: 2024-08-30
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

  1. Sinun täytyy täyttää perusvaatimukset, jotka on määritelty kohdassa Write contributions to Docs.

  2. 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

  1. Käytä SSH-avaimia tunnistautuaksesi GitLab-etäpalvelimelle.

  2. 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.

Luo paikallinen alihakemisto, johon Docs-arkiston klooni tallennetaan

Luo päähakemisto mkdir-komennolla HakemistonNimi

$ mkdir ~/FedoraDocs

Määritä arkisto

Fork a project

GitLabissa siirry ylärepositorioon ja valitse yläreunasta Fork-painike. Valitse haarautuneelle projektille nimiavaruus (GitLab-tunnuksesi) ja näkyvyystaso, mikä luo haarautumisen GitLab-tilillesi.

Jos sinulla ei ole oikeutta luoda projektia, avaa ongelmapyyntö GitLabissa luodaksesi sellaisen itsellesi.

Kloonaa arkisto

Valitse haarautuneessa repositoriossasi sininen Kloonaa-painikkeen alasvetovalikko ja valitse sitten Kloonaa SSH:lla. Kopioi linkki leikepöydälle.

Siirry päädokumenttihakemistoosi ja kloonaa repo.

$ cd FedoraDocs

Kun kloonaat tietovarastoa, voit määrittää uuden hakemiston nimen lisäargumentiksi. Tämä luo ContributorsGuide-alihakemiston ja kloonaa repon siihen hakemistoon.

$ git clone <GIT URL> ContributorsGuide
$ cd ContributorsGuide

Tarkista nykyinen haara, joka on oletus- tai päähaara.

$ git status

Show all branches on the remote.

$ git branch -v -a

Luoda haara ja vaihtaa siihen,

$ git checkout -b <new-branch>

Working on content

Avaa tiedosto(t) valitsemallasi tekstieditorilla, muokkaa ja tallenna.

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.