Skip to content

Commit

Permalink
fix: public only build
Browse files Browse the repository at this point in the history
  • Loading branch information
jameshounshell committed Aug 10, 2023
1 parent ac34c1f commit 718ad91
Showing 1 changed file with 2 additions and 43 deletions.
45 changes: 2 additions & 43 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,38 +37,15 @@ jobs:
fi
# Tag with both registries GHCR and
if [ '${{ github.event_name != 'pull_request' }}' == 'true' ]; then
# release to all registries
GHCR=ghcr.io/${GITHUB_REPOSITORY,,}
ARTIFACTORY=docker.pennywise.cc/${GITHUB_REPOSITORY,,}
TAGS="${ARTIFACTORY}:${VERSION},${GHCR}:${VERSION},${ARTIFACTORY}:$ML_PROJECT_VERSION,${GHCR}:$ML_PROJECT_VERSION"
else
# only internal staging
ARTIFACTORY="docker-builds.pennywise.cc/${GITHUB_REPOSITORY,,}"
TAGS="$ARTIFACTORY:$ML_PROJECT_VERSION"
fi
TAGS="${GHCR}:${VERSION},${GHCR}:$ML_PROJECT_VERSION"
# outputs
for out in "build-date=$(date +%Y%m%d-%H:%M:%S)" "build-user=$(whoami)" "git-branch=$(git rev-parse --abbrev-ref HEAD)" "git-version=$(git rev-parse HEAD)" "version=${VERSION}" "tags=${TAGS}" "created=$(date -u +'%Y-%m-%dT%H:%M:%SZ')"; do
# echo "k=v" >> $GITHUB_OUTPUT
echo $out | tee >(cat) >> $GITHUB_OUTPUT
done
- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Context for Buildx
id: buildx-context
run: |
docker context create builders
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
with:
driver: docker-container
driver-opts: network=host
version: latest
endpoint: builders
buildkitd-flags: --debug --allow-insecure-entitlement network.host
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
Expand All @@ -77,33 +54,15 @@ jobs:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Login to docker.pennywise.cc
uses: docker/login-action@v2
with:
registry: docker.pennywise.cc
username: ${{ secrets.ARTIFACTORY_USERNAME }}
password: ${{ secrets.ARTIFACTORY_PASSWORD }}

- name: Login to docker-builds.pennywise.cc
uses: docker/login-action@v2
with:
registry: docker-builds.pennywise.cc
username: ${{ secrets.ARTIFACTORY_USERNAME }}
password: ${{ secrets.ARTIFACTORY_PASSWORD }}

- name: Build and Push
uses: docker/build-push-action@v2
with:
allow: network.host
push: true
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.prep.outputs.tags }}
file: Dockerfile
context: .
cache-from: type=gha
cache-to: type=gha
build-args: |
ARTIFACTORY_PASSWORD=${{ secrets.ARTIFACTORY_PASSWORD }}
ARTIFACTORY_USERNAME=${{ secrets.ARTIFACTORY_USERNAME }}
BUILD_DATE=${{ steps.prep.outputs.build-date }}
BUILD_USER=${{ steps.prep.outputs.build-user }}
GIT_BRANCH=${{ steps.prep.outputs.git-branch }}
Expand Down

0 comments on commit 718ad91

Please sign in to comment.