Skip to content

Commit

Permalink
Update publish workflow to run during releases (#46)
Browse files Browse the repository at this point in the history
* update to trigger workflow on release

Signed-off-by: sk593 <[email protected]>

---------

Signed-off-by: sk593 <[email protected]>
  • Loading branch information
sk593 authored Jul 11, 2024
1 parent eebd5f8 commit 1d4209e
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions .github/workflows/publish-bicep.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -63,30 +70,34 @@ 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:
name: aws-bicep-types
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
Expand Down

0 comments on commit 1d4209e

Please sign in to comment.