From c0719dc427685b89c52b6c60e104da70f317dbd7 Mon Sep 17 00:00:00 2001 From: David Karlsson <35727626+dvdksn@users.noreply.github.com> Date: Fri, 6 Dec 2024 12:52:10 +0100 Subject: [PATCH 1/2] build: dedup gha introduction content Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com> --- .../manuals/build/ci/github-actions/_index.md | 172 +----------------- 1 file changed, 3 insertions(+), 169 deletions(-) diff --git a/content/manuals/build/ci/github-actions/_index.md b/content/manuals/build/ci/github-actions/_index.md index ddf7ac4044..444bc3bc3f 100644 --- a/content/manuals/build/ci/github-actions/_index.md +++ b/content/manuals/build/ci/github-actions/_index.md @@ -43,172 +43,6 @@ refer to the following sections: ## Get started with GitHub Actions -{{< include "gha-tutorial.md" >}} -This tutorial walks you through the process of setting up and using Docker GitHub -Actions for building Docker images, and pushing images to Docker Hub. You will -complete the following steps: - -1. Create a new repository on GitHub. -2. Define the GitHub Actions workflow. -3. Run the workflow. - -To follow this tutorial, you need a Docker ID and a GitHub account. - -### Step one: Create the repository - -Create a GitHub repository and configure the Docker Hub credentials. - -1. Create a new GitHub repository using - [this template repository](https://github.com/dvdksn/clockbox/generate). - - The repository contains a simple Dockerfile, and nothing else. Feel free to - use another repository containing a working Dockerfile if you prefer. - -2. Open the repository **Settings**, and go to **Secrets and variables** > **Actions**. - -3. Create a new **Repository variable** named `DOCKERHUB_USERNAME` and your Docker ID as value. - -4. Create a new - [personal access token](/security/for-developers/access-tokens/#create-an-access-token) - for Docker Hub. You can name this token `clockboxci`. - -5. Add the Docker Hub access token as a **Repository secret** in your GitHub repository, with the name - `DOCKERHUB_TOKEN`. - -With your repository created, and credentials configured, you're now ready for -action. - -### Step two: Set up the workflow - -Set up your GitHub Actions workflow for building and pushing the image to Docker -Hub. - -1. Go to your repository on GitHub and then select the **Actions** tab. -2. Select **set up a workflow yourself**. - - This takes you to a page for creating a new GitHub actions workflow file in - your repository, under `.github/workflows/main.yml` by default. - -3. In the editor window, copy and paste the following YAML configuration. - - ```yaml - name: ci - - on: - push: - branches: - - "main" - - jobs: - build: - runs-on: ubuntu-latest - ``` - - - `name`: the name of this workflow. - - `on.push.branches`: specifies that this workflow should run on every push - event for the branches in the list. - - `jobs`: creates a job ID (`build`) and declares the type of machine that - the job should run on. - -For more information about the YAML syntax used here, see -[Workflow syntax for GitHub Actions](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions). - -### Step three: Define the workflow steps - -Now the essentials: what steps to run, and in what order to run them. - -```yaml -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Login to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ vars.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Build and push - uses: docker/build-push-action@v6 - with: - push: true - tags: ${{ vars.DOCKERHUB_USERNAME }}/clockbox:latest -``` - -The previous YAML snippet contains a sequence of steps that: - -1. Signs in to Docker Hub, using the - [Docker Login](https://github.com/marketplace/actions/docker-login) action and your Docker Hub credentials. -2. Creates a BuildKit builder instance using the - [Docker Setup Buildx](https://github.com/marketplace/actions/docker-setup-buildx) action. -3. Builds the container image and pushes it to the Docker Hub repository, using - [Build and push Docker images](https://github.com/marketplace/actions/build-and-push-docker-images). - - The `with` key lists a number of input parameters that configures the step: - - - `push`: tells the action to upload the image to a registry after building - it. - - `tags`: tags that specify where to push the image. - -Add these steps to your workflow file. The full workflow configuration should -look as follows: - - -```yaml -name: ci - -on: - push: - branches: - - "main" - -jobs: - build: - runs-on: ubuntu-latest - steps: - - name: Login to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ vars.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Build and push - uses: docker/build-push-action@v6 - with: - push: true - tags: ${{ vars.DOCKERHUB_USERNAME }}/clockbox:latest -``` - -### Run the workflow - -Save the workflow file and run the job. - -1. Select **Commit changes...** and push the changes to the `main` branch. - - After pushing the commit, the workflow starts automatically. - -2. Go to the **Actions** tab. It displays the workflow. - - Selecting the workflow shows you the breakdown of all the steps. - -3. When the workflow is complete, go to your - [repositories on Docker Hub](https://hub.docker.com/repositories). - - If you see the new repository in that list, it means the GitHub Actions - successfully pushed the image to Docker Hub. - -## Next steps - -This tutorial has shown you how to create a simple GitHub Actions workflow, -using the official Docker actions, to build and push an image to Docker Hub. - -There are many more things you can do to customize your workflow to better suit -your needs. To learn more about some of the more advanced use cases, take a look -at the advanced examples, such as [building multi-platform images](multi-platform.md), -or [using cache storage backends](cache.md) and also how to [configure your builder](configure-builder.md). +The [Introduction to GitHub Actions with Docker](/guides/gha.md) guide walks +you through the process of setting up and using Docker GitHub Actions for +building Docker images, and pushing images to Docker Hub. From b2264d26cb92d6cd6ea56a5b747dc1829022f7e0 Mon Sep 17 00:00:00 2001 From: David Karlsson <35727626+dvdksn@users.noreply.github.com> Date: Fri, 6 Dec 2024 12:55:49 +0100 Subject: [PATCH 2/2] guides: add cross-references to gha intro guide Signed-off-by: David Karlsson <35727626+dvdksn@users.noreply.github.com> --- content/guides/bun/configure-ci-cd.md | 6 ++++-- content/guides/cpp/configure-ci-cd.md | 3 ++- content/guides/dotnet/configure-ci-cd.md | 3 ++- content/guides/golang/configure-ci-cd.md | 3 ++- content/guides/java/configure-ci-cd.md | 3 ++- content/guides/nodejs/configure-ci-cd.md | 3 ++- content/guides/php/configure-ci-cd.md | 3 ++- content/guides/python/configure-ci-cd.md | 3 ++- content/guides/r/configure-ci-cd.md | 3 ++- content/guides/ruby/configure-ci-cd.md | 3 ++- content/guides/rust/configure-ci-cd.md | 3 ++- 11 files changed, 24 insertions(+), 12 deletions(-) diff --git a/content/guides/bun/configure-ci-cd.md b/content/guides/bun/configure-ci-cd.md index b1634220ff..b14e34d39b 100644 --- a/content/guides/bun/configure-ci-cd.md +++ b/content/guides/bun/configure-ci-cd.md @@ -122,8 +122,10 @@ Save the workflow file and run the job. In this section, you learned how to set up a GitHub Actions workflow for your Bun application. Related information: - - [Introduction to GitHub Actions](/manuals/build/ci/github-actions/_index.md) - - [Workflow syntax for GitHub Actions](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions) + +- [Introduction to GitHub Actions](/guides/gha.md) +- [Docker Build GitHub Actions](/manuals/build/ci/github-actions/_index.md) +- [Workflow syntax for GitHub Actions](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions) ## Next steps diff --git a/content/guides/cpp/configure-ci-cd.md b/content/guides/cpp/configure-ci-cd.md index 9b4d289de1..6f0e9de613 100644 --- a/content/guides/cpp/configure-ci-cd.md +++ b/content/guides/cpp/configure-ci-cd.md @@ -124,7 +124,8 @@ In this section, you learned how to set up a GitHub Actions workflow for your C+ Related information: -- [Introduction to GitHub Actions](/manuals/build/ci/github-actions/_index.md) +- [Introduction to GitHub Actions](/guides/gha.md) +- [Docker Build GitHub Actions](/manuals/build/ci/github-actions/_index.md) - [Workflow syntax for GitHub Actions](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions) ## Next steps diff --git a/content/guides/dotnet/configure-ci-cd.md b/content/guides/dotnet/configure-ci-cd.md index b951f25f73..3e667a30f2 100644 --- a/content/guides/dotnet/configure-ci-cd.md +++ b/content/guides/dotnet/configure-ci-cd.md @@ -139,7 +139,8 @@ In this section, you learned how to set up a GitHub Actions workflow for your ap Related information: -- [Introduction to GitHub Actions](/manuals/build/ci/github-actions/_index.md) +- [Introduction to GitHub Actions](/guides/gha.md) +- [Docker Build GitHub Actions](/manuals/build/ci/github-actions/_index.md) - [Workflow syntax for GitHub Actions](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions) ## Next steps diff --git a/content/guides/golang/configure-ci-cd.md b/content/guides/golang/configure-ci-cd.md index 92c9fef314..5ef7d63a19 100644 --- a/content/guides/golang/configure-ci-cd.md +++ b/content/guides/golang/configure-ci-cd.md @@ -124,7 +124,8 @@ In this section, you learned how to set up a GitHub Actions workflow for your ap Related information: -- [Introduction to GitHub Actions](/manuals/build/ci/github-actions/_index.md) +- [Introduction to GitHub Actions](/guides/gha.md) +- [Docker Build GitHub Actions](/manuals/build/ci/github-actions/_index.md) - [Workflow syntax for GitHub Actions](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions) ## Next steps diff --git a/content/guides/java/configure-ci-cd.md b/content/guides/java/configure-ci-cd.md index 0fa8043a01..554a02f067 100644 --- a/content/guides/java/configure-ci-cd.md +++ b/content/guides/java/configure-ci-cd.md @@ -134,7 +134,8 @@ In this section, you learned how to set up a GitHub Actions workflow for your ap Related information: -- [Introduction to GitHub Actions](/manuals/build/ci/github-actions/_index.md) +- [Introduction to GitHub Actions](/guides/gha.md) +- [Docker Build GitHub Actions](/manuals/build/ci/github-actions/_index.md) - [Workflow syntax for GitHub Actions](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions) ## Next steps diff --git a/content/guides/nodejs/configure-ci-cd.md b/content/guides/nodejs/configure-ci-cd.md index 947f8c80c6..b1215aff47 100644 --- a/content/guides/nodejs/configure-ci-cd.md +++ b/content/guides/nodejs/configure-ci-cd.md @@ -131,7 +131,8 @@ In this section, you learned how to set up a GitHub Actions workflow for your No Related information: -- [Introduction to GitHub Actions](/manuals/build/ci/github-actions/_index.md) +- [Introduction to GitHub Actions](/guides/gha.md) +- [Docker Build GitHub Actions](/manuals/build/ci/github-actions/_index.md) - [Workflow syntax for GitHub Actions](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions) ## Next steps diff --git a/content/guides/php/configure-ci-cd.md b/content/guides/php/configure-ci-cd.md index 90b5ccba5a..ba6319e376 100644 --- a/content/guides/php/configure-ci-cd.md +++ b/content/guides/php/configure-ci-cd.md @@ -139,7 +139,8 @@ In this section, you learned how to set up a GitHub Actions workflow for your ap Related information: -- [Introduction to GitHub Actions](/manuals/build/ci/github-actions/_index.md) +- [Introduction to GitHub Actions](/guides/gha.md) +- [Docker Build GitHub Actions](/manuals/build/ci/github-actions/_index.md) - [Workflow syntax for GitHub Actions](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions) ## Next steps diff --git a/content/guides/python/configure-ci-cd.md b/content/guides/python/configure-ci-cd.md index 621b42ce01..e82d06945d 100644 --- a/content/guides/python/configure-ci-cd.md +++ b/content/guides/python/configure-ci-cd.md @@ -124,7 +124,8 @@ In this section, you learned how to set up a GitHub Actions workflow for your Py Related information: -- [Introduction to GitHub Actions](/manuals/build/ci/github-actions/_index.md) +- [Introduction to GitHub Actions](/guides/gha.md) +- [Docker Build GitHub Actions](/manuals/build/ci/github-actions/_index.md) - [Workflow syntax for GitHub Actions](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions) ## Next steps diff --git a/content/guides/r/configure-ci-cd.md b/content/guides/r/configure-ci-cd.md index 6faa7d0bbc..8e2465d271 100644 --- a/content/guides/r/configure-ci-cd.md +++ b/content/guides/r/configure-ci-cd.md @@ -124,7 +124,8 @@ In this section, you learned how to set up a GitHub Actions workflow for your R Related information: -- [Introduction to GitHub Actions](/manuals/build/ci/github-actions/_index.md) +- [Introduction to GitHub Actions](/guides/gha.md) +- [Docker Build GitHub Actions](/manuals/build/ci/github-actions/_index.md) - [Workflow syntax for GitHub Actions](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions) ## Next steps diff --git a/content/guides/ruby/configure-ci-cd.md b/content/guides/ruby/configure-ci-cd.md index 254798f5b1..b4a440519b 100644 --- a/content/guides/ruby/configure-ci-cd.md +++ b/content/guides/ruby/configure-ci-cd.md @@ -123,7 +123,8 @@ In this section, you learned how to set up a GitHub Actions workflow for your Ru Related information: -- [Introduction to GitHub Actions](/manuals/build/ci/github-actions/_index.md) +- [Introduction to GitHub Actions](/guides/gha.md) +- [Docker Build GitHub Actions](/manuals/build/ci/github-actions/_index.md) - [Workflow syntax for GitHub Actions](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions) ## Next steps diff --git a/content/guides/rust/configure-ci-cd.md b/content/guides/rust/configure-ci-cd.md index cf3832b283..027b0b8dcf 100644 --- a/content/guides/rust/configure-ci-cd.md +++ b/content/guides/rust/configure-ci-cd.md @@ -123,7 +123,8 @@ In this section, you learned how to set up a GitHub Actions workflow for your Ru Related information: -- [Introduction to GitHub Actions](/manuals/build/ci/github-actions/_index.md) +- [Introduction to GitHub Actions](/guides/gha.md) +- [Docker Build GitHub Actions](/manuals/build/ci/github-actions/_index.md) - [Workflow syntax for GitHub Actions](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions) ## Next steps