Skip to content

Commit 1b9b0c7

Browse files
authored
Merge pull request #10 from dotnetprog/feature/CreateReleaseOntagWorkflow
add gh action
2 parents 1504248 + 3b26d83 commit 1b9b0c7

File tree

1 file changed

+72
-0
lines changed

1 file changed

+72
-0
lines changed

.github/workflows/ci-tag-release.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
name: Create Release on Tag
2+
on:
3+
push:
4+
# Sequence of patterns matched against refs/tags
5+
tags:
6+
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10
7+
8+
9+
env:
10+
solutionPath: '${{ github.workspace }}/src/Dataverse.ConfigurationMigrationTool/Dataverse.ConfigurationMigrationTool.sln'
11+
solutionFolder: '${{ github.workspace }}/src/Dataverse.ConfigurationMigrationTool'
12+
toolpublishlocation: '${{ github.workspace }}/configurationmigrationtool'
13+
jobs:
14+
15+
16+
build:
17+
18+
runs-on: ubuntu-latest
19+
20+
steps:
21+
- uses: actions/checkout@v3
22+
with:
23+
fetch-depth: 0
24+
- name: Setup .NET
25+
uses: actions/setup-dotnet@v3
26+
with:
27+
dotnet-version: 8.0.x
28+
29+
- name: Restore dependencies
30+
run: dotnet restore ${{ env.solutionPath }}
31+
- name: Build
32+
run: dotnet build ${{ env.solutionPath }} --configuration Release --no-restore
33+
- name: dotnet publish
34+
run: dotnet publish ${{ env.solutionFolder }}/Dataverse.ConfigurationMigrationTool.Console/Dataverse.ConfigurationMigrationTool.Console.csproj -c Release -o ${{env.toolpublishlocation}}
35+
- name: Upload tool artifact
36+
uses: actions/upload-artifact@v4
37+
with:
38+
name: configurationmigrationtool
39+
path: ${{env.toolpublishlocation}}
40+
41+
release:
42+
name: Create Release from tag
43+
runs-on: ubuntu-latest
44+
steps:
45+
- name: Download tool artifact
46+
uses: actions/download-artifact@v4
47+
with:
48+
name: configurationmigrationtool
49+
path: '${{ github.workspace }}/configurationmigrationtool'
50+
- name: zip artifact # This would actually build your project, using zip for an example artifact
51+
run: |
52+
zip -r configurationmigrationtool${{ github.ref }}.zip configurationmigrationtool
53+
- name: Create Release
54+
id: create_release
55+
uses: actions/create-release@v1
56+
env:
57+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
58+
with:
59+
tag_name: ${{ github.ref }}
60+
release_name: Release ${{ github.ref }}
61+
draft: false
62+
prerelease: false
63+
- name: Upload Release Asset
64+
id: upload-release-asset
65+
uses: actions/upload-release-asset@v1
66+
env:
67+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
68+
with:
69+
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
70+
asset_path: ./configurationmigrationtool${{ github.ref }}.zip
71+
asset_name: configurationmigrationtool${{ github.ref }}.zip
72+
asset_content_type: application/zip

0 commit comments

Comments
 (0)