Fix function writer #1606
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish Docker image | |
on: | |
workflow_dispatch: | |
push: | |
tags: ["v*"] | |
paths: ["src/**", ".github/workflows/**"] | |
pull_request: | |
paths: ["src/**", ".github/workflows/**"] | |
schedule: | |
- cron: "0 18 * * 4" # 18:00 UTC every Thursday ~ 14:00 EST every Thursday | |
env: | |
REGISTRY: msgraphprod.azurecr.io | |
IMAGE_NAME: public/openapi/kiota | |
PREVIEW_BRANCH: "refs/heads/main" | |
jobs: | |
build_image: | |
if: ${{ github.event_name == 'pull_request' || github.event_name == 'push' }} | |
name: Build Docker image | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build image | |
uses: docker/[email protected] | |
with: | |
push: false | |
platforms: linux/amd64,linux/arm64/v8,linux/arm/v7 | |
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:validation | |
push_to_registry: | |
# so we don't publish from main twice since preview tags are generated by ADO | |
if: ${{ (!contains(github.ref, 'refs/tags/v') || !contains(github.ref, '-preview')) && github.event_name != 'pull_request'}} | |
needs: [] | |
environment: | |
name: acr | |
name: Push Docker image | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v4 | |
- name: Login to GitHub package feed | |
uses: docker/[email protected] | |
with: | |
username: ${{ secrets.ACR_USERNAME }} | |
password: ${{ secrets.ACR_PASSWORD }} | |
registry: ${{ env.REGISTRY }} | |
- 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 | |
- run: ./scripts/get-prerelease-version.ps1 -currentBranch ${{github.ref}} -previewBranch ${{ env.PREVIEW_BRANCH }} -excludeHeadingDash -isGHA | |
id: getversionsuffix | |
shell: pwsh | |
name: "Set version suffix" | |
env: | |
BUILD_BUILDNUMBER: ${{ steps.runnumber.outputs.runnumber }} | |
- run: ./scripts/update-version-suffix-for-source-generator.ps1 -versionSuffix "${{steps.getversionsuffix.outputs.versionSuffix}}" | |
if: contains(github.ref, env.PREVIEW_BRANCH) | |
shell: pwsh | |
name: "Set version suffix in csproj for generators" | |
- run: ./scripts/get-version-from-csproj.ps1 -isGHA | |
id: getversion | |
shell: pwsh | |
name: "Get Kiota's version-number from .csproj" | |
- run: ./scripts/get-release-notes.ps1 -version "${{ steps.getversion.outputs.version }}" | |
if: ${{!contains(github.ref, env.PREVIEW_BRANCH)}} | |
name: "Get release notes from CHANGELOG.md" | |
shell: pwsh | |
- run: ./scripts/get-release-notes.ps1 -version Unreleased | |
if: contains(github.ref, env.PREVIEW_BRANCH) | |
name: "Get release notes from CHANGELOG.md" | |
shell: pwsh | |
- run: ./scripts/update-versions.ps1 | |
shell: pwsh | |
name: "Update dependencies versions" | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- 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 GitHub Packages - Nightly | |
if: contains(github.ref, env.PREVIEW_BRANCH) | |
uses: docker/[email protected] | |
with: | |
push: true | |
platforms: linux/amd64,linux/arm64/v8,linux/arm/v7 | |
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 }} | |
# we can't get the sequence number from ADO so we default it back to github run number | |
- name: Push to GitHub Packages - Release | |
if: contains(github.ref, 'refs/tags/v') | |
uses: docker/[email protected] | |
with: | |
push: true | |
platforms: linux/amd64,linux/arm64/v8,linux/arm/v7 | |
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest,${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.getversion.outputs.version }} |