Add the optional build-arg input #126
Workflow file for this run
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
name: CI | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
# https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs#defining-access-for-the-github_token-scopes | |
permissions: write-all | |
jobs: | |
ghcr: | |
runs-on: "ubuntu-20.04" # https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Run an action | |
uses: ./ | |
with: | |
image_name: "MaCBre/Push-to-ghcr" # make sure this is lowercased by the action | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
image_tag: foo_tag | |
- name: Make sure that an image has been built and tagged properly | |
env: | |
IMAGE: ghcr.io/${{ github.repository }} | |
run: | | |
docker images | grep ${IMAGE} | |
docker images | grep foo_tag | |
- name: Make sure that an image has been pushed and is properly labelled | |
env: | |
IMAGE: ghcr.io/${{ github.repository }} | |
run: | | |
set -x | |
docker rmi ${IMAGE}:foo_tag | |
docker pull ${IMAGE}:foo_tag | |
docker image inspect ${IMAGE}:foo_tag | jq '.[].Config.Labels' | tee /dev/fd/2 | grep "${GITHUB_SHA}" | |
ghcr_with_dockerfile_in_subdir: | |
runs-on: "ubuntu-20.04" # https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Run an action | |
uses: ./ | |
with: | |
image_name: "foo/bar-app" | |
dockerfile: "./foo/bar/Dockerfile" | |
context: "./foo" | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Make sure that an image has been built | |
env: | |
IMAGE: ghcr.io/foo/bar-app | |
run: | | |
set -x | |
docker images | grep ${IMAGE} | |
docker image inspect ${IMAGE} | jq '.[].Config.Labels' | tee /dev/fd/2 | grep "${GITHUB_SHA}" | |
ghcr_and_docker_io: | |
runs-on: "ubuntu-20.04" # https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idruns-on | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Run an action | |
uses: ./ | |
with: | |
image_name: ${{ github.repository }} | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
docker_io_token: ${{ secrets.DOCKER_IO_ACCESS_TOKEN }} # see https://hub.docker.com/settings/security | |
- name: Make sure that an image has been built | |
env: | |
IMAGE: ${{ github.repository }} | |
run: | | |
docker images | grep ${IMAGE} | |
- name: Make sure that an image has been pushed and is properly labelled | |
env: | |
IMAGE: ${{ github.repository }} | |
run: | | |
set -x | |
docker rmi ghcr.io/${IMAGE} | |
docker rmi docker.io/${IMAGE} | |
docker pull ghcr.io/${IMAGE} | |
docker pull docker.io/${IMAGE} | |
docker image inspect ghcr.io/${IMAGE} | jq '.[].Config.Labels' | tee /dev/fd/2 | grep "${GITHUB_SHA}" | |
docker image inspect docker.io/${IMAGE} | jq '.[].Config.Labels' | tee /dev/fd/2 | grep "${GITHUB_SHA}" |