Skip to content

Commit

Permalink
Merge pull request #99 from ccamacho/master
Browse files Browse the repository at this point in the history
chore: add container image in quay
  • Loading branch information
ccamacho authored Nov 23, 2020
2 parents 9be2bb2 + dc553cb commit 0ba566a
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 25 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@ jobs:
- name: Create collection build and publish
run: |
chmod +x ./tools/release.sh
sudo GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} ./tools/release.sh -k ${{ secrets.GALAXY_KEY }}
sudo GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} \
QUAY_USER=${{ secrets.QUAY_USER }} \
QUAY_KEY=${{ secrets.QUAY_KEY }} \
GALAXY_KEY=${{ secrets.GALAXY_KEY }} \
./tools/release.sh
release_docs:
needs: release_sw
Expand Down
2 changes: 1 addition & 1 deletion kubeinit/galaxy.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
namespace: kubeinit
name: kubeinit
version: 0.6.0
version: 0.6.1
readme: README.md
authors:
- Carlos Camacho <[email protected]>
Expand Down
50 changes: 27 additions & 23 deletions tools/release.sh
Original file line number Diff line number Diff line change
@@ -1,27 +1,24 @@
#!/bin/bash

PARAMS=""
while (( "$#" )); do
case "$1" in
-k|--galaxy-key)
KARG=$2
shift 2
;;
--) # end argument parsing
shift
break
;;
-*|--*=) # unsupported flags
echo "Error: Unsupported flag $1" >&2
echo "Please use ./publish.sh [-k <galaxy key> | --galaxy-key <galaxy key>]" >&2
exit 1
;;
*) # preserve positional arguments
PARAMS="$PARAMS $1"
shift
;;
esac
done
if [ -z "$GITHUB_TOKEN" ]; then
echo "GITHUB_TOKEN is not set";
exit 1;
fi

if [ -z "$QUAY_USER" ]; then
echo "QUAY_USER is not set";
exit 1;
fi

if [ -z "$QUAY_KEY" ]; then
echo "QUAY_KEY is not set";
exit 1;
fi

if [ -z "$GALAXY_KEY" ]; then
echo "GALAXY_KEY is not set";
exit 1;
fi

#
# Initial variables
Expand Down Expand Up @@ -83,11 +80,18 @@ done
if [ "$publish" == "1" ]; then
echo 'This version is not published, publishing!...'

echo 'Building and pushing the container image to quay...'
docker login -u="$QUAY_USER" -p="$QUAY_KEY" quay.io
docker build . --file Dockerfile --tag quay.io/kubeinit/kubeinit:$current_galaxy_version
docker push quay.io/kubeinit/kubeinit:$current_galaxy_version

echo 'Building and pushing the Ansible collecction to Ansible Galaxy...'
cd ./kubeinit/
mkdir -p releases
ansible-galaxy collection build -v --force --output-path releases/
ansible-galaxy collection publish \
releases/$current_galaxy_namespace-$current_galaxy_name-$current_galaxy_version.tar.gz --api-key $KARG
releases/$current_galaxy_namespace-$current_galaxy_name-$current_galaxy_version.tar.gz --api-key $GALAXY_KEY

echo 'Building and pushing a new tag GitHub...'
curl --data "$(generate_post_data)" "https://api.github.com/repos/kubeinit/kubeinit/releases?access_token=$GITHUB_TOKEN"
fi

0 comments on commit 0ba566a

Please sign in to comment.