Skip to content

Commit c110bb9

Browse files
committed
- adds a workflow to automate github releases on tags
- updates docker workflow to support nightly and releases - adds a changelog file - adds a description to the docker file
1 parent 458edef commit c110bb9

File tree

4 files changed

+92
-5
lines changed

4 files changed

+92
-5
lines changed
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Create GitHub release
2+
on:
3+
push:
4+
tags: ['v*']
5+
6+
jobs:
7+
publish_binaries:
8+
name: Publish binaries
9+
runs-on: ubuntu-latest
10+
strategy:
11+
matrix:
12+
architecture:
13+
- win-x64
14+
- win-x86
15+
- linux-x64
16+
- osx-x64
17+
steps:
18+
- uses: actions/checkout@v2
19+
- name: Setup .NET
20+
uses: actions/setup-dotnet@v1
21+
with:
22+
dotnet-version: 5.0.x
23+
- name: Publish ${{ matrix.architecture }}
24+
run: dotnet publish ./src/kiota/kiota.csproj -c Release -p:PublishSingleFile=true -r ${{ matrix.architecture }} -o ./${{ matrix.architecture }}
25+
- name: Archive Release ${{ matrix.architecture }}
26+
uses: thedoctor0/zip-release@master
27+
with:
28+
filename: './${{ matrix.architecture }}.zip'
29+
path: './${{ matrix.architecture }}'
30+
- uses: actions/upload-artifact@v2
31+
with:
32+
name: binaries-${{ matrix.architecture }}
33+
path: ./${{ matrix.architecture }}.zip
34+
create_release:
35+
name: Create Release
36+
needs: [publish_binaries]
37+
environment:
38+
name: gh_releases
39+
runs-on: ubuntu-latest
40+
steps:
41+
- uses: actions/checkout@v2
42+
- uses: actions/download-artifact@v2
43+
with:
44+
path: output
45+
- name: Release
46+
uses: anton-yurchenko/git-release@v3.4.4
47+
env:
48+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
49+
DRAFT_RELEASE: "false"
50+
PRE_RELEASE: "false"
51+
CHANGELOG_FILE: "CHANGELOG.md"
52+
ALLOW_EMPTY_CHANGELOG: "true"
53+
ALLOW_TAG_PREFIX: "true"
54+
with:
55+
args: |
56+
output/binaries-*/*.zip

.github/workflows/docker.yml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ name: Publish Docker image
22
on:
33
push:
44
branches: [main]
5+
tags: ['v*']
56
paths: ['src/**', '.github/workflows/**']
67
jobs:
78
push_to_registry:
@@ -18,8 +19,23 @@ jobs:
1819
username: ${{ github.actor }}
1920
password: ${{ secrets.GITHUB_TOKEN }}
2021
registry: docker.pkg.github.com
21-
- name: Push to GitHub Packages
22+
- run: |
23+
$version = $Env:BRANCH_NAME -replace "refs/tags/v",""
24+
echo "::set-output name=version::${version}"
25+
shell: pwsh
26+
id: getversion
27+
if: contains(github.ref, 'refs/tags/v')
28+
env:
29+
BRANCH_NAME: ${{ github.ref }}
30+
- name: Push to GitHub Packages - Nightly
31+
if: contains(github.ref, 'refs/head/main')
2232
uses: docker/build-push-action@v2
2333
with:
2434
push: true
25-
tags: docker.pkg.github.com/microsoft/kiota/generator:latest
35+
tags: docker.pkg.github.com/microsoft/kiota/generator:nightly
36+
- name: Push to GitHub Packages - Release
37+
if: contains(github.ref, 'refs/tags/v')
38+
uses: docker/build-push-action@v2
39+
with:
40+
push: true
41+
tags: docker.pkg.github.com/microsoft/kiota/generator:latest,docker.pkg.github.com/microsoft/kiota/generator:${{ steps.getversion.outputs.version }}

CHANGELOG.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [Unreleased]
9+
10+
## [0.0.1] - 2021-04-20
11+
12+
### Added
13+
14+
- Initial GitHub release

Dockerfile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ FROM mcr.microsoft.com/dotnet/sdk:5.0 AS build-env
22
WORKDIR /app
33

44
COPY ./src ./kiota/src
5-
COPY ./tests ./kiota/tests
6-
COPY ./kiota.sln ./kiota
75
WORKDIR /app/kiota
86
RUN dotnet publish ./src/kiota/kiota.csproj -c Release
97

@@ -14,4 +12,7 @@ COPY --from=build-env /app/kiota/src/kiota/bin/Release/net5.0 ./
1412

1513
VOLUME /app/output
1614
VOLUME /app/openapi.yml
17-
ENTRYPOINT ["dotnet", "kiota.dll"]
15+
ENTRYPOINT ["dotnet", "kiota.dll"]
16+
LABEL description="# Welcome to Kiota Generator \
17+
To start generating SDKs checkout [the getting started documentation](https://github.com/microsoft/kiota/#running-kiota-with-docker) \
18+
[Source dockerfile](https://github.com/microsoft/kiota/blob/main/releases/Dockerfile)"

0 commit comments

Comments
 (0)