Skip to content
This repository was archived by the owner on Aug 29, 2025. It is now read-only.

Commit 671e8af

Browse files
committed
Add workflow to publish docker images.
1 parent c25d4c4 commit 671e8af

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
name: Publish Docker image
2+
on:
3+
workflow_dispatch:
4+
inputs:
5+
tag:
6+
description: 'The tag to build'
7+
required: true
8+
type: string
9+
push:
10+
branches: [main]
11+
tags: ['v*']
12+
paths: ['src/**', '.github/workflows/**']
13+
jobs:
14+
push_to_registry:
15+
name: Push Docker image to GitHub Packages
16+
runs-on: ubuntu-latest
17+
env:
18+
MSGRAPH_DOCKER_REGISTRY_URL: docker.pkg.github.com
19+
PACKAGE_VERSION: ${{github.event.inputs.tag || github.ref_name || 'v0.1.0'}}
20+
NUGET_USER: ${{ secrets.NUGET_USER }}
21+
NUGET_TOKEN: ${{ secrets.NUGET_PASSWORD }}
22+
steps:
23+
- id: get-version
24+
run: |
25+
PACKAGE_VERSION=$(echo $PACKAGE_VERSION | sed s/^v//)
26+
echo "::set-output name=version::$PACKAGE_VERSION"
27+
- name: Prepare secret files
28+
run: |
29+
echo $NUGET_USER > nuget_user.txt
30+
echo $NUGET_TOKEN > nuget_token.txt
31+
- name: Check out the repo
32+
uses: actions/checkout@v3
33+
with:
34+
submodules: true
35+
ref: ${{github.event.inputs.tag || ''}}
36+
- name: Login to GitHub package feed
37+
uses: docker/[email protected]
38+
with:
39+
username: ${{ github.actor }}
40+
password: ${{ secrets.GITHUB_TOKEN }}
41+
registry: docker.pkg.github.com
42+
- name: Push to GitHub Packages - Nightly
43+
if: contains(github.ref, 'refs/head/main')
44+
uses: docker/[email protected]
45+
with:
46+
push: true
47+
tags: docker.pkg.github.com/microsoftgraph/msgraph-cli/msgraph-cli:nightly
48+
- name: Push to GitHub Packages - Release
49+
if: contains(github.ref, 'refs/tags/v')
50+
uses: docker/[email protected]
51+
with:
52+
push: true
53+
tags: docker.pkg.github.com/microsoftgraph/msgraph-cli/msgraph-cli:latest,docker.pkg.github.com/microsoftgraph/msgraph-cli/msgraph-cli:${{ steps.get-version.outputs.version }}

0 commit comments

Comments
 (0)