From 1ac96b69fcd3d73d32cfbd5faa2e023ae4ebd987 Mon Sep 17 00:00:00 2001 From: Olivier Cervello Date: Fri, 3 Sep 2021 14:58:39 +0200 Subject: [PATCH] Remove release workflows --- .github/workflows/rc-release.yml | 45 -------------------------------- .github/workflows/release.yml | 36 ++++++++++++++++++++++++- cloudbuild.yaml | 2 +- 3 files changed, 36 insertions(+), 47 deletions(-) delete mode 100644 .github/workflows/rc-release.yml diff --git a/.github/workflows/rc-release.yml b/.github/workflows/rc-release.yml deleted file mode 100644 index f99fd08d..00000000 --- a/.github/workflows/rc-release.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: rc-release-version -on: - push: - branches: - - release-v*.*.*-rc* -jobs: - release-pypi: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: "Verify version is a release candidate" - run: | - cat "setup.py" | grep "version = .*-rc*" - - uses: actions/setup-python@master - with: - python-version: '3.x' - architecture: 'x64' - - - name: Run all tests - run: make - env: - MIN_VALID_EVENTS: "10" - GOOGLE_APPLICATION_CREDENTIALS: tests/unit/fixtures/fake_credentials.json - - - name: Release PyPI package - run: make deploy - env: - TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }} - TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }} - TWINE_REPOSITORY_URL: https://upload.pypi.org/legacy/ - release-gcr: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Set up Cloud SDK - uses: google-github-actions/setup-gcloud@master - with: - project_id: ${{ secrets.PROJECT_ID }} - service_account_key: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }} - export_default_credentials: true - - name: Build Docker container and publish on GCR - run: make cloudbuild || true - env: - GCR_PROJECT_ID: ${{ secrets.GCR_PROJECT_ID }} - CLOUDBUILD_PROJECT_ID: ${{ secrets.CLOUDBUILD_PROJECT_ID }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index cfd69274..fe99afbf 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -8,6 +8,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 + - uses: actions/setup-python@master with: python-version: '3.x' @@ -25,18 +26,51 @@ jobs: TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }} TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }} TWINE_REPOSITORY_URL: https://upload.pypi.org/legacy/ + release-gcr: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 + - name: Set up Cloud SDK uses: google-github-actions/setup-gcloud@master with: project_id: ${{ secrets.PROJECT_ID }} service_account_key: ${{ secrets.GOOGLE_APPLICATION_CREDENTIALS }} export_default_credentials: true - - name: Build Docker container and publish on GCR + + - name: Check release version + id: check-tag + run: | + echo ::set-output name=version::$(echo ${{ github.event.ref }} | cut -d / -f 3 | cut -c2-) + if [[ ${{ github.event.ref }} =~ ^refs/tags/v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + echo ::set-output name=match::true + fi + + - name: Build Docker container and publish on GCR [v*.*.*] + run: make cloudbuild + env: + GCR_PROJECT_ID: ${{ secrets.GCR_PROJECT_ID }} + CLOUDBUILD_PROJECT_ID: ${{ secrets.CLOUDBUILD_PROJECT_ID }} + VERSION: ${{ steps.check-tag.outputs.version }} + + - name: Build Docker container and publish on GCR [latest] run: make cloudbuild + if: ${{ steps.check-tag.outputs.match == 'true' }} + env: + GCR_PROJECT_ID: ${{ secrets.GCR_PROJECT_ID }} + CLOUDBUILD_PROJECT_ID: ${{ secrets.CLOUDBUILD_PROJECT_ID }} + VERSION: latest + + - name: Deploy Docker container to Cloud Run + run: make cloudrun + if: ${{ steps.check-tag.outputs.match == 'true' }} env: GCR_PROJECT_ID: ${{ secrets.GCR_PROJECT_ID }} CLOUDBUILD_PROJECT_ID: ${{ secrets.CLOUDBUILD_PROJECT_ID }} + CLOUDRUN_PROJECT_ID: ${{ secrets.CLOUDRUN_PROJECT_ID }} + VERSION: ${{ steps.check-tag.outputs.version }} + CONFIG_URL: gs://${{ secrets.CLOUDRUN_PROJECT_ID }}/config.yaml + SIGNATURE_TYPE: http + REGION: ${{ secrets.REGION }} + SERVICE_ACCOUNT: ${{ secrets.CLOUDRUN_SERVICE_ACCOUNT }} diff --git a/cloudbuild.yaml b/cloudbuild.yaml index 9d70a771..230d7e7f 100644 --- a/cloudbuild.yaml +++ b/cloudbuild.yaml @@ -18,7 +18,7 @@ steps: id: Build SLO generator args: ['build', '-t', 'gcr.io/$_GCR_PROJECT_ID/slo-generator:${_VERSION}', '.'] -- name: gcr.io/$_GCR_PROJECT_ID/slo-generator +- name: gcr.io/$_GCR_PROJECT_ID/slo-generator:${_VERSION} id: Run all tests entrypoint: make env: