Skip to content

Commit

Permalink
Fix docker images publishing
Browse files Browse the repository at this point in the history
Signed-off-by: Julien Pivotto <[email protected]>
  • Loading branch information
roidelapluie committed Sep 6, 2022
1 parent fab4e54 commit dc17fd5
Show file tree
Hide file tree
Showing 9 changed files with 54 additions and 20 deletions.
5 changes: 2 additions & 3 deletions .github/actions/build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ runs:
- uses: ./.github/actions/setup_environment
- run: ~/go/bin/promu crossbuild -v --parallelism ${{ inputs.parallelism }} --parallelism-thread ${{ inputs.thread }} ${{ inputs.promu_opts }}
shell: bash
- uses: actions/upload-artifact@v3
- uses: ./.github/actions/save_artefacts
with:
path: |
.build
directory: .build
8 changes: 5 additions & 3 deletions .github/actions/publish_images/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,16 @@ runs:
steps:
- name: Download all workflow run artifacts
uses: actions/download-artifact@v3
with:
name: artifact
- uses: ./.github/actions/setup_environment
- if: "inputs.dockerfile_path != ''"
- if: inputs.dockerfile_path != ''
run: echo "export DOCKERFILE_PATH=${{ inputs.dockerfile_path }}" >> /tmp/tmp-profile
shell: bash
- if: "inputs.container_image_name != ''"
- if: inputs.container_image_name != ''
run: echo "export DOCKER_IMAGE_NAME=${{ inputs.container_image_name }}" >> /tmp/tmp-profile
shell: bash
- if: "inputs.dockerbuild_context != ''"
- if: inputs.dockerbuild_context != ''
run: echo "export DOCKERBUILD_CONTEXT=${{ inputs.dockerbuild_context }}" >> /tmp/tmp-profile
shell: bash
- run: |
Expand Down
2 changes: 2 additions & 0 deletions .github/actions/publish_main/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ runs:
using: composite
steps:
- uses: ./.github/actions/setup_environment
with:
enable_docker_multibuild: true
- uses: ./.github/actions/publish_images
if: inputs.docker_hub_organization != '' && inputs.docker_hub_login != ''
with:
Expand Down
2 changes: 2 additions & 0 deletions .github/actions/publish_release/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ runs:
using: composite
steps:
- uses: ./.github/actions/setup_environment
with:
enable_docker_multibuild: true
- run: promu crossbuild tarballs
shell: bash
- run: promu checksum .tarballs
Expand Down
14 changes: 8 additions & 6 deletions .github/actions/publish_release_image/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,17 @@ runs:
steps:
- name: Download all workflow run artifacts
uses: actions/download-artifact@v3
with:
name: artifact
- uses: ./.github/actions/setup_environment
- if: "inputs.dockerfile_path != ''"
run: echo "export DOCKERFILE_PATH=${{ inputs.dockerfile_path }}" }} /tmp/tmp-profile
- if: inputs.dockerfile_path != ''
run: echo "export DOCKERFILE_PATH=${{ inputs.dockerfile_path }}" >> /tmp/tmp-profile
shell: bash
- if: "inputs.container_image_name != ''"
run: echo "export DOCKER_IMAGE_NAME=${{ inputs.container_image_name }}" }} /tmp/tmp-profile
- if: inputs.container_image_name != ''
run: echo "export DOCKER_IMAGE_NAME=${{ inputs.container_image_name }}" >> /tmp/tmp-profile
shell: bash
- if: "inputs.dockerbuild_context != ''"
run: echo "export DOCKERBUILD_CONTEXT=${{ inputs.dockerbuild_context }}" }} /tmp/tmp-profile
- if: inputs.dockerbuild_context != ''
run: echo "export DOCKERBUILD_CONTEXT=${{ inputs.dockerbuild_context }}" >> /tmp/tmp-profile
shell: bash
- run: |
current_tag=${GITHUB_REF#refs/*/}
Expand Down
18 changes: 18 additions & 0 deletions .github/actions/save_artefacts/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# To preserve the directory structure, save an additional empty file at
# the root of the working directory. GitHub action uses the least common
# ancestor of all the search paths as the root directory for artefacts.
name: Save artefacts
inputs:
directory:
type: string
description: Path of the directory to save
runs:
using: composite
steps:
- run: touch .keep
shell: bash
- uses: actions/upload-artifact@v3
with:
path: |
${{ inputs.directory }}
.keep
18 changes: 14 additions & 4 deletions .github/actions/setup_environment/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,16 @@ inputs:
enable_npm:
type: boolean
description: Whether to enable npm specific features, such as caching.
default: true
default: false
enable_docker_multibuild:
type: boolean
description: Whether to enable multibuild docker
default: false
runs:
using: composite
steps:
- uses: actions/cache@v3
if: ${{ inputs.enable_go }}
if: inputs.enable_go == 'true'
with:
path: |
~/.cache/go-build
Expand All @@ -21,7 +25,7 @@ runs:
restore-keys: |
${{ runner.os }}-go-
- uses: actions/cache@v3
if: ${{ inputs.enable_npm }}
if: inputs.enable_npm == 'true'
with:
path: |
~/.npm
Expand All @@ -30,4 +34,10 @@ runs:
${{ runner.os }}-npm-
- run: make promu
shell: bash
if: ${{ inputs.enable_go }}
if: inputs.enable_go == 'true'
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
if: inputs.enable_docker_multibuild == 'true'
- name: Set up buildx
uses: docker/setup-buildx-action@v1
if: inputs.enable_docker_multibuild == 'true'
5 changes: 2 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,9 @@ jobs:
- run: make assets-tarball
- run: make ui-lint
- run: make ui-test
- uses: actions/upload-artifact@v3
- uses: ./.github/actions/save_artefacts
with:
path: |
.tarballs
directory: .tarballs

test_windows:
runs-on: windows-latest
Expand Down
2 changes: 1 addition & 1 deletion Makefile.common
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ common-tarball: promu
.PHONY: common-docker $(BUILD_DOCKER_ARCHS)
common-docker: $(BUILD_DOCKER_ARCHS)
$(BUILD_DOCKER_ARCHS): common-docker-%:
docker build -t "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:$(DOCKER_IMAGE_TAG)" \
docker buildx build -t "$(DOCKER_REPO)/$(DOCKER_IMAGE_NAME)-linux-$*:$(DOCKER_IMAGE_TAG)" \
-f $(DOCKERFILE_PATH) \
--build-arg ARCH="$*" \
--build-arg OS="linux" \
Expand Down

0 comments on commit dc17fd5

Please sign in to comment.