Skip to content

Commit

Permalink
Make conditional on having DOCKER_USERNAME and DOCKER_PASSWORD secret…
Browse files Browse the repository at this point in the history
… keys, github packages does not support multiarch

Signed-off-by: miigotu <miigotu@gmail.com>
  • Loading branch information
miigotu committed Jul 3, 2020
1 parent e3c093f commit 52657e1
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@ jobs:
run: |
# echo ::set-output name=docker_platforms::linux/amd64,linux/386
echo ::set-output name=docker_platforms::linux/amd64
echo ::set-output name=docker_username::miigotu
echo ::set-output name=github_image::docker.pkg.github.com/${GITHUB_REPOSITORY,,}/ps3toolchain
echo ::set-output name=github_image::docker.pkg.github.com/${GITHUB_REPOSITORY,,}/ps3dev
# echo ::set-output name=docker_image::docker.io/${GITHUB_REPOSITORY,,}
echo ::set-output name=docker_image::docker.io/ps3dev/ps3dev
VERSION_TAG=${GITHUB_REF#refs/*/}
echo ::set-output name=version::${VERSION_TAG%/merge}
- name: Available platforms
Expand All @@ -44,12 +45,16 @@ jobs:
if: success()
id: login
env:
GITHUB_USERNAME: ${{ github.actor }}
GITHUB_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_PASSWORD: ${{ secrets.DOCKER_TOKEN }}
run: |
echo "${GITHUB_PASSWORD}" | docker login --username "${{ steps.prepare.outputs.docker_username }}" --password-stdin docker.pkg.github.com
echo "${GITHUB_PASSWORD}" | docker login --username "${GITHUB_USERNAME}" --password-stdin docker.pkg.github.com
echo "${DOCKER_PASSWORD}" | docker login --username "${DOCKER_USERNAME}" --password-stdin docker.io
echo ::set-output name=buildx::$(echo docker buildx build --output type=image,push=true \
--platform ${{ steps.prepare.outputs.docker_platforms }} --cache-from "type=local,src=/tmp/.buildx-cache" --cache-to "type=local,dest=/tmp/.buildx-cache" \
--tag "${{ steps.prepare.outputs.github_image }}:${{ steps.prepare.outputs.version }}")
--tag "${{ steps.prepare.outputs.docker_image }}:${{ steps.prepare.outputs.version }}")
- name: Cache Docker layers
uses: actions/cache@v2
id: cache
Expand All @@ -59,11 +64,11 @@ jobs:
restore-keys: |
${{ runner.os }}-buildx-
- name: Run Buildx (master)
if: success() && steps.prepare.outputs.version == 'master'
if: secrets.DOCKER_USERNAME && secrets.DOCKER_PASSWORD && success() && steps.prepare.outputs.version == 'master'
run: |
${{ steps.login.outputs.buildx }} --tag "${{ steps.prepare.outputs.github_image }}:latest" --file Dockerfile .
${{ steps.login.outputs.buildx }} --tag "${{ steps.prepare.outputs.docker }}:latest" --file Dockerfile .
- name: Run Buildx (non-master)
if: success() && steps.prepare.outputs.version != 'master'
if: secrets.DOCKER_USERNAME && secrets.DOCKER_PASSWORD && success() && steps.prepare.outputs.version != 'master'
run: |
${{ steps.login.outputs.buildx }} --file Dockerfile .
- name: Clear
Expand Down

0 comments on commit 52657e1

Please sign in to comment.