This lesson demonstrates how to set up a CI/CD workflow for container images.
Specifically, this demo implements a delivery workflow that:
- Reuses a workflow to run integration tests
- Collects metadata
- Builds the image
- Publishes the image to GitHub Packages
-
Create a new repo and upload the files for this lesson.
-
Rename the file python-ci-workflow.yml so that its located in the
.github/workflows
directory.Completing this step is key to having the workflow run properly!
-
In the repo select the Actions tab.
-
Select and configure the workflow Publish Docker Container.
-
Under
jobs
, add an ID named “integration” and the keyworduses
followed by the path topython-ci-workflow.yml
.NOTE that the path to the workflow starts with
./
and contains the full path the workflow file.Add a permissions block followed by
contents: read
andchecks: write
.The completed call to the reused workflow should be similar to the following:
jobs: integration: uses: ./.github/workflows/python-ci-workflow.yml permissions: contents: read checks: write
-
Under the job with the ID
build
, addneeds
, followed by the ID for the integration job. This will cause thebuild
job to wait for theintegration
job to complete.build: needs: [integration]
-
Select Start Commit and then select Commit New File.
-
Select the Actions tab.
-
Select the running workflow.
-
Observe the
integration/build
job followed by thebuild
job. -
Observe the updates to the Actions UI as the
integration/build
job completes. -
Once the workflow completes, select the Code tab.
-
Refresh the page as needed until the package is listed under Packages.
-
Select the package and review the details on the package page.
At the time this course was published, the Publish Docker Container workflow contained actions based on Node 12
.
Node 12 has been out of support since April 2022 and has been deprecated by Github Actions.
This causes warnings to be written to the Actions UI.
To remove these warnings, the version for actions used in this workflow need to be updated.
Update your workflow to use the following actions with the indicated versions. Also, check the provided Marketplace page to see if newer versions are available.
Action Marketplace Page | Action Name and Version |
---|---|
Docker Setup Buildx | docker/[email protected] |
Docker Login | docker/[email protected] |
Docker Metadata action | docker/[email protected] |
Build and push Docker images | docker/[email protected] |