Update api file service #724
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
name: Chartpress Publish | |
on: push | |
jobs: | |
build: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v1 | |
- name: Login to DockerHub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Setup python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.6' | |
- name: Setup git | |
run: git config --global user.email "[email protected]" && git config --global user.name "Github Action" | |
- name: Install Chartpress and some python modules | |
run: | | |
pip install -v chartpress && pip install six && pip install yq | |
- name: Set env vars for publish charts | |
run: | | |
GIT_BRANCH_NAME=${GITHUB_BASE_REF:-${GITHUB_REF#refs/heads/}} | |
GIT_BRANCH_NAME=${GIT_BRANCH_NAME/\//_} | |
OSM_SEED_VERSION=$(yq -r .appVersion ./osm-seed/Chart.yaml) | |
SHORT_GITHUB_SHA=${GITHUB_SHA::7} | |
echo "GIT_BRANCH_NAME=$GIT_BRANCH_NAME" >> $GITHUB_ENV | |
echo "OSM_SEED_VERSION=$OSM_SEED_VERSION" >> $GITHUB_ENV | |
echo "SHORT_GITHUB_SHA=$SHORT_GITHUB_SHA" >> $GITHUB_ENV | |
- name: Run Chartpress | |
env: | |
GITHUB_TOKEN: ${{ secrets.REPO_TOKEN }} | |
GITHUB_EVENT_NAME: ${{ github.event_name }} | |
run: | | |
if [[ $GIT_BRANCH_NAME = "main" ]] | |
then | |
chartpress --push --publish-chart --tag ${OSM_SEED_VERSION} | |
elif [[ $GIT_BRANCH_NAME = "develop" ]] | |
then | |
chartpress --push --publish-chart --tag ${OSM_SEED_VERSION}-dev.h$SHORT_GITHUB_SHA | |
else | |
chartpress --push --publish-chart | |
fi |