Skip to content

Commit

Permalink
Only try to publush docker images if secrets.DOCKER_CI is set
Browse files Browse the repository at this point in the history
  • Loading branch information
nurikk-sa committed Mar 26, 2023
1 parent 9fdf416 commit fc46a76
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
8 changes: 8 additions & 0 deletions .github/workflows/apt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,16 @@ jobs:

- name: Build and tag docker image
run: docker build -t ghcr.io/hyperion-project/${{ matrix.file }}:${{ matrix.tag }} --build-arg DIST=${{ matrix.dist }} --build-arg SUITE=${{ matrix.tag }} -f apt/${{ matrix.file }} .
- name: Check whether we should publsh to GitHub Container/Package Registry
id: enabledockerpublish
env:
SECRET_DOCKER_CI: ${{ secrets.DOCKER_CI }}
run: |
echo "Enable docker publish: ${{ env.SECRET_DOCKER_CI != '' }}"
echo "::set-output name=enabledockerpublish::${{ env.SECRET_DOCKER_CI != '' }}"
- name: Publish to GitHub Container Registry
if: steps.enabledockerpublish.outputs.enabledockerpublish == 'true'
run: |
echo ${{ secrets.DOCKER_CI }} | docker login ghcr.io -u ${{ github.repository_owner }} --password-stdin
docker push ghcr.io/hyperion-project/${{ matrix.file }}:${{ matrix.tag }}
9 changes: 8 additions & 1 deletion .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,15 @@ jobs:
- name: Build and tag docker image
run: |
docker build -t ghcr.io/hyperion-project/${{ matrix.dockerImage }}:${{ matrix.dockerTag }} --build-arg SUITE=${{ matrix.dockerTag }} -f ${{ matrix.dockerImage }} .
- name: Check whether we should publsh to GitHub Container/Package Registry
id: enabledockerpublish
env:
SECRET_DOCKER_CI: ${{ secrets.DOCKER_CI }}
run: |
echo "Enable docker publish: ${{ env.SECRET_DOCKER_CI != '' }}"
echo "::set-output name=enabledockerpublish::${{ env.SECRET_DOCKER_CI != '' }}"
- name: Publish to GitHub Container/Package Registry
if: steps.enabledockerpublish.outputs.enabledockerpublish == 'true'
run: |
echo ${{ secrets.DOCKER_CI }} | docker login ghcr.io -u ${{ github.actor }} --password-stdin
docker push ghcr.io/hyperion-project/${{ matrix.dockerImage }}:${{ matrix.dockerTag }}

0 comments on commit fc46a76

Please sign in to comment.