Merge pull request #332 from Ratio1/develop #97
This file contains hidden or 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
| # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go | |
| name: Build main branchimage and tag commit/image with version number | |
| on: | |
| push: | |
| branches: | |
| - "main" | |
| workflow_dispatch: | |
| jobs: | |
| tag-and-build-push-mainnet: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| # - name: Checkout code | |
| # uses: actions/checkout@v3 | |
| - name: Configure Git | |
| run: | | |
| git config --local user.email "action@github.com" | |
| git config --local user.name "GitHub Action" | |
| ## version getting and debugging | |
| - name: Retrieve edge node version | |
| id: retrieve_version | |
| run: | | |
| echo "VERSION=$(cat ver.py | grep -o "'.*'")" >> $GITHUB_ENV | |
| - name: Check latest naeural_core version | |
| id: check_core_latest_version | |
| run: | | |
| LATEST_VERSION=$(curl -s https://pypi.org/pypi/naeural-core/json | jq -r '.info.version') | |
| echo "LATEST_NAEURAL_CORE_VERSION=$LATEST_VERSION" >> $GITHUB_ENV | |
| - name: Debug version | |
| run: | | |
| VERSION=${VERSION//\'/} | |
| echo "Develop version to build: '$VERSION'" | |
| echo "Latest naeural_core version on PyPI: '$LATEST_NAEURAL_CORE_VERSION'" | |
| env: | |
| VERSION: ${{ env.VERSION }} | |
| LATEST_NAEURAL_CORE_VERSION: ${{ env.LATEST_NAEURAL_CORE_VERSION }} | |
| ## End of version getting and debugging | |
| - name: Create image tag | |
| id: create_image_tag | |
| run: | | |
| VERSION=${VERSION//\'/} | |
| echo "IMAGE_TAG=ratio1/edge_node:$VERSION" >> $GITHUB_ENV | |
| env: | |
| VERSION: ${{ env.VERSION }} | |
| - name: Debug version | |
| run: | | |
| VERSION=${VERSION//\'/} | |
| echo "Version to tag: '$VERSION'" | |
| echo "Image tag: '$IMAGE_TAG'" | |
| env: | |
| VERSION: ${{ env.VERSION }} | |
| IMAGE_TAG: ${{ env.IMAGE_TAG }} | |
| - name: Tag main commit | |
| run: | | |
| VERSION=${VERSION//\'/} | |
| git tag -a $VERSION -m "Version $VERSION" | |
| git push origin $VERSION | |
| env: | |
| VERSION: ${{ env.VERSION }} | |
| - name: Log in to Docker Hub | |
| uses: docker/login-action@v3 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| with: | |
| version: "lab:latest" | |
| driver: cloud | |
| endpoint: "naeural/naeural-builder" | |
| - name: Cleanup space | |
| run: | | |
| echo "===========docker buildx du ===================" | |
| docker buildx du | |
| echo "===========docker buildx prune -f. Add -af if any other space issues. ============" | |
| docker buildx prune -f | |
| echo "===========docker buildx du =================" | |
| docker buildx du | |
| echo "========================================" | |
| - name: Build and push the Amd64 Mainnet image | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: . | |
| file: ./Dockerfile_mainnet | |
| push: true | |
| tags: | | |
| ${{ env.IMAGE_TAG }} | |
| ratio1/edge_node:latest | |
| ratio1/edge_node:mainnet |