|
| 1 | +name: Release Robusta-CLI |
| 2 | + |
| 3 | +on: |
| 4 | + release: |
| 5 | + types: [published] |
| 6 | + workflow_dispatch: # This allows manual triggering |
| 7 | + |
| 8 | +env: |
| 9 | + PROJECT_ID: ${{ secrets.GKE_PROD_PROJECT }} |
| 10 | + RELEASE_VER : 0.0.1 # ${{ github.event.release.tag_name }} |
| 11 | +jobs: |
| 12 | + |
| 13 | + setup-build-publish-deploy: |
| 14 | + name: Build images |
| 15 | + runs-on: ubuntu-latest |
| 16 | + |
| 17 | + steps: |
| 18 | + - name: Checkout |
| 19 | + uses: actions/checkout@v2 |
| 20 | + |
| 21 | + - name: Get release version |
| 22 | + run: echo "$RELEASE_VER" |
| 23 | + |
| 24 | + - uses: google-github-actions/setup-gcloud@v0.2.0 |
| 25 | + with: |
| 26 | + service_account_key: ${{ secrets.GKE_PROD_SA_KEY }} |
| 27 | + project_id: ${{ secrets.GKE_PROD_PROJECT }} |
| 28 | + export_default_credentials: true |
| 29 | + |
| 30 | + # Configure Docker to use the gcloud command-line tool as a credential helper for authentication |
| 31 | + - run: |- |
| 32 | + gcloud auth configure-docker us-central1-docker.pkg.dev |
| 33 | +
|
| 34 | + - run: |- |
| 35 | + gcloud config get-value project |
| 36 | +
|
| 37 | + - name: Update package version |
| 38 | + run: | |
| 39 | + sed -i 's/0.0.0/${{env.RELEASE_VER}}/g' src/robusta_cli/_version.py pyproject.toml |
| 40 | +
|
| 41 | + # Set up the buildx to run build for multiple platforms |
| 42 | + - name: Set up QEMU |
| 43 | + uses: docker/setup-qemu-action@c5ffa2a61740d9877bd1f40899a87c8ec93b0d9f |
| 44 | + |
| 45 | + - name: Docker Setup Buildx |
| 46 | + uses: docker/setup-buildx-action@bea6a01aa40b4d58b0382d47e1c4a70137af67b1 |
| 47 | + with: |
| 48 | + config-inline: | |
| 49 | + [worker.oci] |
| 50 | + enabled = true |
| 51 | + platforms = [ "linux/amd64", "linux/arm64" ] |
| 52 | +
|
| 53 | + - name: Set up Python |
| 54 | + uses: actions/setup-python@v2 |
| 55 | + with: |
| 56 | + python-version: 3.12 |
| 57 | + |
| 58 | + - name: Install dependencies |
| 59 | + run: | |
| 60 | + python -m pip install --upgrade pip |
| 61 | + pip install twine # TODO is twine needed? |
| 62 | +
|
| 63 | + - name: Prepare pypi dist |
| 64 | + run: | |
| 65 | + curl -sSL https://install.python-poetry.org | python3 - --version 1.8.2 |
| 66 | + poetry config virtualenvs.create false |
| 67 | + poetry install --no-dev |
| 68 | +# poetry publish --build -u __token__ -p ${{ secrets.PYPI_PROJECT_TOKEN }} |
| 69 | + |
| 70 | + - name: Release Docker CLI only on formal releases |
| 71 | +# if: "!github.event.release.prerelease" |
| 72 | + run: |- |
| 73 | + docker buildx build \ |
| 74 | + --platform linux/arm64,linux/amd64 \ |
| 75 | + --tag us-central1-docker.pkg.dev/genuine-flight-317411/devel/robusta-cli:dummy-${{env.RELEASE_VER}} \ |
| 76 | +# --tag us-central1-docker.pkg.dev/genuine-flight-317411/devel/robusta-cli \ |
| 77 | + --push \ |
| 78 | + --file cli.Dockerfile \ |
| 79 | + . |
0 commit comments