|
| 1 | +name: Publish Docker image |
| 2 | +on: |
| 3 | + workflow_dispatch: |
| 4 | + push: |
| 5 | + branches: [master, vnext] |
| 6 | + paths: ['src/Microsoft.OpenApi.Hidi/**', '.github/workflows/**'] |
| 7 | +env: |
| 8 | + REGISTRY: msgraphprod.azurecr.io |
| 9 | + IMAGE_NAME: public/hidi |
| 10 | +jobs: |
| 11 | + push_to_registry: |
| 12 | + environment: |
| 13 | + name: acr |
| 14 | + name: Push Docker image |
| 15 | + runs-on: ubuntu-latest |
| 16 | + steps: |
| 17 | + - name: Check out the repo |
| 18 | + uses: actions/checkout@v3 |
| 19 | + - name: Login to GitHub package feed |
| 20 | + |
| 21 | + with: |
| 22 | + username: ${{ secrets.ACR_USERNAME }} |
| 23 | + password: ${{ secrets.ACR_PASSWORD }} |
| 24 | + registry: ${{ env.REGISTRY }} |
| 25 | + - run: | |
| 26 | + $content = [XML](Get-Content ./src/Microsoft.OpenApi.Hidi/Microsoft.OpenApi.Hidi.csproj) |
| 27 | + $version = $content.Project.PropertyGroup.Version |
| 28 | + echo "::set-output name=version::${version}" |
| 29 | + shell: pwsh |
| 30 | + id: getversion |
| 31 | + if: contains(github.ref, 'refs/tags/v') |
| 32 | + env: |
| 33 | + BRANCH_NAME: ${{ github.ref }} |
| 34 | + - name: Push to GitHub Packages - Nightly |
| 35 | + if: contains(github.ref, 'refs/head/vnext') |
| 36 | + |
| 37 | + with: |
| 38 | + push: true |
| 39 | + tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:nightly |
| 40 | + - name: Push to GitHub Packages - Release |
| 41 | + if: contains(github.ref, 'refs/head/master') |
| 42 | + |
| 43 | + with: |
| 44 | + push: true |
| 45 | + tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest,${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.getversion.outputs.version }} |
0 commit comments