Skip to content

Update file(s) "artifact" from "cloudforet-io/api" #67

Update file(s) "artifact" from "cloudforet-io/api"

Update file(s) "artifact" from "cloudforet-io/api" #67

Workflow file for this run

name: SpaceONE Buff API
on:
push:
branches:
- master
jobs:
deploy:
if: github.repository_owner == 'cloudforet-io'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set environment virables
env:
SERVICE: api
PYPI_UPLOAD: true # upload pypi if this is true
# LOCATION points the parent directory
LOCATION_SETUP_PY: dist/python # optional. for pypi upload
LOCATION_VERSION: . # the location for VERSION file (ex- . means the location of VERSION is ./VERSION)
ARTIFACT_VERSION: ./artifact/json
IS_SUDO: true
run: |
echo "SERVICE=$SERVICE" >> $GITHUB_ENV
echo "PYPI_UPLOAD=$PYPI_UPLOAD" >> $GITHUB_ENV
echo "LOCATION_SETUP_PY=$LOCATION_SETUP_PY" >> $GITHUB_ENV
echo "LOCATION_VERSION=$LOCATION_VERSION" >> $GITHUB_ENV
echo "IS_SUDO=$IS_SUDO" >> $GITHUB_ENV
echo "ARTIFACT_VERSION=$ARTIFACT_VERSION" >> $GITHUB_ENV
- name: Clone master branch
uses: actions/checkout@v2
with:
ref: master
path: master_branch
- name: Compare version
run: |
echo "MASTER BRANCH VERSION"
cat master_branch/$LOCATION_VERSION/VERSION
echo -e "\n\n"
echo "PR VERSION"
cat $LOCATION_VERSION/VERSION
echo -e "\n\n"
echo "IS_NEW_VERSION=false" >> $GITHUB_ENV
cmp --silent master_branch/$LOCATION_VERSION/VERSION $LOCATION_VERSION/VERSION || \
echo "IS_NEW_VERSION=true" >> $GITHUB_ENV
echo "API_DOC_VERSION=$(cat $LOCATION_VERSION/VERSION)" >> $GITHUB_ENV
echo "API_VERSION_NAME=$(cat $LOCATION_VERSION/VERSION)" >> $GITHUB_ENV
echo "$(cat $LOCATION_VERSION/VERSION)-${{ github.run_id }}">$LOCATION_VERSION/VERSION
- name: Versioning with baranches
id: check_files
uses: andstor/file-existence-action@v1
with:
files: "artifact/json/VERSION"
- name: File exists
if: steps.check_files.outputs.files_exists == 'true'
run: |
echo "ARTIFACT_VERSION=$(cat $ARTIFACT_VERSION/VERSION)" >> $GITHUB_ENV
- name: Check version updates # Check which version is latest, if doc version is higher and then create a release branch
if: env.ARTIFACT_VERSION > env.API_DOC_VERSION
uses: peterjgrainger/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
branch: ${{ env.API_VERSION_NAME }}
- name: Update API doc Version
run: |
echo "$API_DOC_VERSION">$LOCATION_VERSION/VERSION
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.8'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel twine
pip install PyYAML
pip install Jinja2
pip install pydash
- name: generate markdowns
run: |
cd bin
python markdown.py
- name: Commit files # transfer the new html files back into the repository
run: |
git config --local user.name "SpaceONE"
git add .
git commit -m "Update modified markdowns"
- name: Push changes # push the output folder to your repo
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
force: true