-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit bac39ba
Showing
5 changed files
with
150 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
name: Build and release Docker images | ||
on: | ||
push: | ||
branches-ignore: | ||
- '**' | ||
tags: | ||
- 'v*.*.*' | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Build Docker image | ||
uses: flownative/action-docker-build@v1 | ||
with: | ||
tag_ref: ${{ github.ref }} | ||
git_repository_url: https://github.com/${{ github.repository }} | ||
git_sha: ${{ github.sha }} | ||
image_name: flownative/docker-action-helm-release/action-helm-release | ||
registry_password: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Determine latest released version | ||
id: latest_version | ||
uses: flownative/action-git-latest-release@master | ||
|
||
- name: Tag semver releases | ||
uses: flownative/action-docker-publish-semver@master | ||
with: | ||
tag_ref: ${{ steps.latest_version.outputs.tag }} | ||
tag_latest: 'yes' | ||
|
||
source_image_name: docker.pkg.github.com/flownative/docker-action-helm-release/action-helm-release | ||
source_registry_username: github | ||
source_registry_password: ${{ secrets.GITHUB_TOKEN }} | ||
source_registry_endpoint: https://docker.pkg.github.com/v2/ | ||
|
||
target_image_name: docker.pkg.github.com/flownative/docker-action-helm-release/action-helm-release | ||
target_registry_username: github | ||
target_registry_password: ${{ secrets.GITHUB_TOKEN }} | ||
target_registry_endpoint: https://docker.pkg.github.com/v2/ | ||
|
||
- name: Publish release to docker.io | ||
uses: flownative/action-docker-publish-semver@master | ||
with: | ||
tag_ref: ${{ steps.latest_version.outputs.tag }} | ||
tag_latest: 'yes' | ||
|
||
source_image_name: docker.pkg.github.com/flownative/docker-action-helm-release/action-helm-release | ||
source_registry_username: github | ||
source_registry_password: ${{ secrets.GITHUB_TOKEN }} | ||
source_registry_endpoint: https://docker.pkg.github.com/v2/ | ||
|
||
target_image_name: flownative/action-helm-release | ||
target_registry_username: ${{ secrets.DOCKER_IO_REGISTRY_USER }} | ||
target_registry_password: ${{ secrets.DOCKER_IO_REGISTRY_PASSWORD }} | ||
target_registry_endpoint: https://index.docker.io/v1/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
FROM flownative/base:1 | ||
|
||
ENV HELM_VERSION v3.0.2 | ||
ENV HELM_HOME=/root/.helm | ||
|
||
# We need Git for "helm plugin install" | ||
RUN apt-get update \ | ||
&& apt-get install git \ | ||
&& rm -rf /var/lib/apt/lists/* \ | ||
&& rm -rf /var/log/apt \ | ||
&& rm -rf /var/log/dpkg.log | ||
|
||
RUN curl -sSL https://get.helm.sh/helm-${HELM_VERSION}-linux-amd64.tar.gz | tar xz \ | ||
&& mv linux-amd64/helm /usr/local/bin/helm \ | ||
&& rm -rf linux-amd64 | ||
|
||
COPY entrypoint.sh /entrypoint.sh | ||
RUN chmod 755 /entrypoint.sh | ||
|
||
ENTRYPOINT ["/entrypoint.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
|
||
The MIT License (MIT) | ||
|
||
Copyright (c) 2020 Robert Lemke, Flownative GmbH | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Docker Image for the Helm Release Github Action | ||
|
||
This is a the actual implementation of the [Flownative Github Action for releasing Helm charts](https://github.com/flownative/action-helm-release). | ||
The actual Github action refers to a pre-built image in its `Dockerfile`, so that the action image does not have to be | ||
re-built on every use. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
#!/bin/bash | ||
set -ex | ||
|
||
helm plugin install https://github.com/chartmuseum/helm-push.git | ||
|
||
export INPUT_CHARTS_FOLDER=${INPUT_CHARTS_FOLDER:-.} | ||
|
||
if [ -z "${INPUT_CHART_NAME}" ]; then | ||
echo "chart_name is not set" | ||
exit 1 | ||
fi | ||
|
||
if [ -z "${INPUT_REPOSITORY_URL}" ]; then | ||
echo "repository_url is not set" | ||
exit 1 | ||
fi | ||
|
||
if [ -z "${INPUT_REPOSITORY_USER}" ]; then | ||
echo "repository_user is not set" | ||
exit 1 | ||
fi | ||
|
||
if [ -z "${INPUT_REPOSITORY_PASSWORD}" ]; then | ||
echo "repository_password is not set" | ||
exit 1 | ||
fi | ||
|
||
if [ -z "${INPUT_CHART_VERSION}" ]; then | ||
echo "chart_version is not set" | ||
exit 1 | ||
fi | ||
|
||
if [ -z "${INPUT_APP_VERSION}" ]; then | ||
echo "app_version is not set" | ||
exit 1 | ||
fi | ||
|
||
INPUT_CHART_VERSION=$(echo "${INPUT_CHART_VERSION}" | sed -e 's|refs/tags||' | sed -e 's/^v//') | ||
INPUT_APP_VERSION=$(echo "${INPUT_APP_VERSION}" | sed -e 's|refs/tags||' | sed -e 's/^v//' | sed -e 's/+.*//') | ||
|
||
cd "${INPUT_CHARTS_FOLDER}" | ||
|
||
helm inspect chart "${INPUT_CHART_NAME}" | ||
helm package --app-version "${INPUT_APP_VERSION}" --version "${INPUT_CHART_VERSION}" "${INPUT_CHART_NAME}" | ||
helm push "${INPUT_CHART_NAME}-${INPUT_CHART_VERSION}.tgz" "${INPUT_REPOSITORY_URL}" --username "${INPUT_REPOSITORY_USER}" --password "${INPUT_REPOSITORY_PASSWORD}" --force |