diff --git a/.github/workflows/push-terraform-module-version.yml b/.github/workflows/push-terraform-module-version.yaml similarity index 54% rename from .github/workflows/push-terraform-module-version.yml rename to .github/workflows/push-terraform-module-version.yaml index 389c2d3..cd42bbb 100644 --- a/.github/workflows/push-terraform-module-version.yml +++ b/.github/workflows/push-terraform-module-version.yaml @@ -8,12 +8,19 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 + - name: Export LATEST_TAG + run: | + echo "LATEST_TAG=$(curl \ + -H "Accept: application/vnd.github+json" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + "${{ github.api_url }}/repos/${{ github.repository }}/releases/latest" \ + | jq -r .tag_name)" >> $GITHUB_ENV + - uses: ministryofjustice/cloud-platform-environments/cmd/push-terraform-module-version@main + name: push version to go-get-module api + if: ${{ github.ref_name == env.LATEST_TAG }} env: - # see https://github.com/ministryofjustice/cloud-platform-go-get-module/ - # get the address from the ingress eg. 'https://' + `kubectl get ing -n cloud-platform-go-get-module-$ENV` API_URL: ${{ vars.TERRAFORM_MODULE_VERSIONS_API_URL }} - # get this via the cli eg. `cloud-platform decode-secret -n cloud-platform-go-get-module-prod -s go-get-module-api-key` API_KEY: ${{ secrets.TERRAFORM_MODULE_VERSIONS_API_KEY }} REPO_NAME: ${{ github.event.repository.name }} UPDATED_MODULE_VERSION: ${{ github.ref_name }}