cyclops-ui-CI #26
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: cyclops-ui-CI | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- cyclops-ui/** | |
workflow_dispatch: | |
permissions: | |
contents: write | |
jobs: | |
cyclops-ui-CI: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Bump ui version in latest file | |
run: | | |
git config pull.rebase false | |
git config pull.rebase true | |
git pull origin main | |
LATEST_VERSION_FILE=$GITHUB_WORKSPACE/install/ui-latest.txt | |
# get current version | |
VERSION=$(cat $LATEST_VERSION_FILE) | |
MAJOR=$(($(cut -d\. -f2 <<< $VERSION) + 1)) | |
# bump | |
VERSION=v0.$MAJOR.0 | |
echo $VERSION > $LATEST_VERSION_FILE | |
# update file | |
git config --global user.email "[email protected]" | |
git config --global user.name "petar-cvit" | |
git add -A | |
git commit -m 'ci update cyclops ui to '$VERSION | |
git push origin HEAD:main | |
- name: Login to DockerHub | |
uses: docker/login-action@v1 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Build and push | |
run: | | |
LATEST_VERSION_FILE=$GITHUB_WORKSPACE/install/ui-latest.txt | |
# get current version | |
VERSION=$(cat $LATEST_VERSION_FILE) | |
docker build cyclops-ui -t petarcvit223/cyclops-ui:$VERSION | |
docker push petarcvit223/cyclops-ui:$VERSION | |
- name: Update install manifest | |
run: | | |
LATEST_VERSION_FILE=$GITHUB_WORKSPACE/install/ui-latest.txt | |
INSTALL_YAML=$GITHUB_WORKSPACE/install/cyclops-install.yaml | |
# get current version | |
VERSION=$(cat $LATEST_VERSION_FILE) | |
sed -i 's/petarcvit223\/cyclops-ui\:.*/petarcvit223\/cyclops-ui\:'$VERSION'/' $INSTALL_YAML | |
# update file | |
git config --global user.email "[email protected]" | |
git config --global user.name "petar-cvit" | |
git status | |
git add . | |
git commit -m 'ci update cyclops ui to '$VERSION | |
git push |