diff --git a/.azure-pipelines/ci-build.yml b/.azure-pipelines/ci-build.yml index 968286c19..ed791e58b 100644 --- a/.azure-pipelines/ci-build.yml +++ b/.azure-pipelines/ci-build.yml @@ -6,7 +6,6 @@ trigger: branches: include: - main - - dev - support/v1 tags: include: @@ -15,7 +14,6 @@ pr: branches: include: - main - - dev - support/v1 variables: buildPlatform: 'Any CPU' diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 4224ace24..776426049 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -2,7 +2,7 @@ name: CodeQL Analysis on: push: - branches: [ main, dev ] + branches: [ main, support/v1 ] pull_request: schedule: - cron: '0 8 * * *' diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 93c8f3e87..ece97b194 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -2,11 +2,13 @@ name: Publish Docker image on: workflow_dispatch: push: - branches: [main, dev, support/v1] - paths: ['src/Microsoft.OpenApi.Hidi/**', '.github/workflows/**'] + tags: ["v*"] + branches: [main] + pull_request: env: REGISTRY: msgraphprod.azurecr.io IMAGE_NAME: public/openapi/hidi + PREVIEW_BRANCH: "refs/heads/main" jobs: push_to_registry: environment: @@ -28,14 +30,24 @@ jobs: echo "::set-output name=version::${version}" shell: pwsh id: getversion + - name: Get truncated run number + if: contains(github.ref, env.PREVIEW_BRANCH) + id: runnumber + run: echo "runnumber=$(echo ${{ github.run_number }} | awk '{ print substr($0, length($0)-3, length($0)) }')" >> $GITHUB_OUTPUT + - name: Get current date + if: contains(github.ref, env.PREVIEW_BRANCH) + id: date + run: echo "date=$(date +'%Y%m%d')" >> $GITHUB_OUTPUT - name: Push to registry - Nightly - if: ${{ github.ref == 'refs/heads/dev' }} + if: contains(github.ref, env.PREVIEW_BRANCH) uses: docker/build-push-action@v6.13.0 with: push: true - tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:nightly + tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:nightly,${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.getversion.outputs.version }}-preview.${{ steps.date.outputs.date }}${{ steps.runnumber.outputs.runnumber }} + build-args: | + version_suffix=preview.${{ steps.date.outputs.date }}${{ steps.runnumber.outputs.runnumber }} - name: Push to registry - Release - if: ${{ github.ref == 'refs/heads/main' || github.ref == 'refs/heads/support/v1' }} + if: contains(github.ref, 'refs/tags/v') uses: docker/build-push-action@v6.13.0 with: push: true