Added push to docker hub

This commit is contained in:
WoLfulus
2020-10-01 14:44:04 -03:00
parent 70f573d593
commit 03b9327565
2 changed files with 20 additions and 6 deletions

View File

@@ -66,7 +66,7 @@ function main() {
push=$(argument push "false")
latest=$(argument latest "false")
registry=$(argument registry "ghcr.io")
registry=$(argument registry "")
registry=$(echo "${registry}" | tr '[:upper:]' '[:lower:]')
repository=$(argument repository "directus/next")
@@ -75,6 +75,11 @@ function main() {
version=$(argument version "")
context=$(argument context ".")
image="${repository}"
if [ "${registry}" != "" ]; then
image="${registry}/${image}"
fi
# Normalize tag
if [ "${version}" == "" ]; then
version=${GITHUB_REF##*/}
@@ -102,7 +107,7 @@ function main() {
# Push latest
# TODO: check if it's really the latest
if [ "${latest}" == "true" ]; then
fqin="${registry}/${repository}:latest"
fqin="${image}:latest"
echo "Tagging ${fqin}"
docker tag directus:main ${fqin}
if [ "${push}" == "true" ]; then
@@ -115,12 +120,12 @@ function main() {
for tag in $tags
do
tag=$(echo "${tag}" | tr '[:upper:]' '[:lower:]')
fqin="${registry}/${repository}:latest"
fqin="${image}:${tag}"
echo "Tagging ${fqin}"
docker tag directus:main "${registry}/${repository}:${tag}"
docker tag directus:main "${fqin}"
if [ "${push}" == "true" ]; then
echo "Pushing tag ${fqin}"
docker push "${registry}/${repository}:${tag}"
docker push "${fqin}"
fi
done

View File

@@ -11,7 +11,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v2
- name: Build
- name: Build GitHub Container Registry
uses: ./.github/actions/build-images
with:
registry: "ghcr.io"
@@ -20,3 +20,12 @@ jobs:
password: "${{ secrets.REGISTRY_PASSWORD }}"
version: "${{ github.ref }}"
push: "true"
- name: Build Docker Hub
uses: ./.github/actions/build-images
with:
repository: "${{ github.repository }}"
username: "${{ secrets.DOCKERHUB_USERNAME }}"
password: "${{ secrets.DOCKERHUB_PASSWORD }}"
version: "${{ github.ref }}"
push: "true"