diff --git a/.github/workflows/publish-bicep.yaml b/.github/workflows/publish-bicep.yaml index 5a5113c5..bab4cd99 100644 --- a/.github/workflows/publish-bicep.yaml +++ b/.github/workflows/publish-bicep.yaml @@ -17,15 +17,22 @@ name: Update extensibility provider types on: push: - branches: [ main ] + branches: + - main + tags: + - v* pull_request: - branches: [ main ] + branches: + - main workflow_dispatch: inputs: {} + env: # bicep-types ACR url for uploading AWS Bicep types BICEP_TYPES_REGISTRY: 'biceptypes.azurecr.io' AWS_REGION: us-west-2 + CI_PUBLISH_RELEASE: ${{ github.repository == 'radius-project/bicep-types-aws' && startsWith(github.ref, 'refs/tags/v') && github.event_name == 'push' }} + CI_PUBLISH_LATEST: ${{ github.repository == 'radius-project/bicep-types-aws' && github.ref == 'refs/heads/main' && github.event_name == 'push' }} jobs: build-and-push-bicep-types: @@ -63,9 +70,11 @@ jobs: git submodule update --init --recursive npm --prefix bicep-types/src/bicep-types ci && npm --prefix bicep-types/src/bicep-types run build; \ - name: Generate Bicep extensibility types for AWS + env: + VERSION: ${{ env.REL_CHANNEL == 'edge' && 'latest' || env.REL_CHANNEL }} run: | npm --prefix ./src/aws-type-generator install - npm run --prefix ./src/aws-type-generator start -- --input ../../artifacts/types --output ../../artifacts/bicep --release-version ${{ env.REL_VERSION == 'edge' && 'latest' || env.REL_VERSION }} + npm run --prefix ./src/aws-type-generator start -- --input ../../artifacts/types --output ../../artifacts/bicep --release-version ${{ env.VERSION }} - name: Upload AWS Bicep types artifacts uses: actions/upload-artifact@v4 with: @@ -73,20 +82,22 @@ jobs: path: ./artifacts/bicep if-no-files-found: error - name: 'Login via Azure CLI' - if: github.repository == 'radius-project/bicep-types-aws' && ((startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')) + if: ${{ env.CI_PUBLISH_LATEST == 'true' || env.CI_PUBLISH_RELEASE == 'true' }} uses: azure/login@v1 with: creds: ${{ secrets.BICEP_TYPES_AZURE_CREDENTIALS }} - name: Setup and verify bicep CLI - if: github.repository == 'radius-project/bicep-types-aws' && ((startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')) + if: ${{ env.CI_PUBLISH_LATEST == 'true' || env.CI_PUBLISH_RELEASE == 'true' }} run: | curl -Lo bicep https://github.com/Azure/bicep/releases/latest/download/bicep-linux-x64 chmod +x ./bicep bicep --version - name: Publish bicep types - if: github.repository == 'radius-project/bicep-types-aws' && ((startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main')) + if: ${{ env.CI_PUBLISH_LATEST == 'true' || env.CI_PUBLISH_RELEASE == 'true' }} + env: + VERSION: ${{ env.REL_CHANNEL == 'edge' && 'latest' || env.REL_CHANNEL }} run: | - bicep publish-provider ./artifacts/bicep/index.json --target br:${{ env.BICEP_TYPES_REGISTRY }}/aws:${{ env.REL_VERSION == 'edge' && 'latest' || env.REL_VERSION }} --force + bicep publish-extension ./artifacts/bicep/index.json --target br:${{ env.BICEP_TYPES_REGISTRY }}/aws:${{ env.VERSION }} --force update-types: if: github.event_name == 'pull_request' && github.base_ref == 'main' name: Update Bicep extensibility provider types