This repository was archived by the owner on Aug 29, 2025. It is now read-only.
Merge pull request #572 from microsoftgraph/dependabot/github_actions… #217
This file contains hidden or 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: | |
| inputs: | |
| tag: | |
| description: 'The tag to build' | |
| required: false | |
| type: string | |
| default: 'main' | |
| push: | |
| branches: [main] | |
| tags: ['v*'] | |
| paths: ['src/**', '.github/workflows/**', 'docker/**', 'Dockerfile'] | |
| env: | |
| IMAGE_NAME: ${{ github.repository }} | |
| REGISTRY: ghcr.io | |
| jobs: | |
| push_to_registry: | |
| name: Push Docker image to GitHub Packages | |
| runs-on: ubuntu-latest | |
| env: | |
| PACKAGE_VERSION: ${{github.event.inputs.tag || github.ref_name || 'v0.1.0'}} | |
| steps: | |
| - id: get-version | |
| run: | | |
| PACKAGE_VERSION=$(echo $PACKAGE_VERSION | sed s/^v//) | |
| echo "::set-output name=version::$PACKAGE_VERSION" | |
| - name: Check out the repo | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: true | |
| ref: ${{github.event.inputs.tag || ''}} | |
| - name: Login to docker registry | |
| uses: docker/[email protected] | |
| with: | |
| username: ${{ github.actor }} | |
| password: ${{ secrets.DOCKER_PUBLISH_TOKEN }} | |
| registry: ${{ env.REGISTRY }} | |
| - name: Push to GitHub Packages - Nightly | |
| if: github.ref == 'refs/heads/main' || github.event.inputs.tag == 'main' | |
| uses: docker/[email protected] | |
| with: | |
| push: true | |
| tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:nightly | |
| - name: Push to GitHub Packages - Release | |
| if: startsWith(github.ref, 'refs/tags/v') || startsWith(github.event.inputs.tag, 'v') | |
| uses: docker/[email protected] | |
| with: | |
| push: true | |
| tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest,${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ steps.get-version.outputs.version }} |