Skip to content

Commit 014fb57

Browse files
Create main.yml
1 parent 81ed098 commit 014fb57

File tree

1 file changed

+155
-0
lines changed

1 file changed

+155
-0
lines changed

.github/workflows/main.yml

Lines changed: 155 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
1+
name: Build and release
2+
3+
on:
4+
# Trigger the workflow on push or pull request,
5+
# but only for the dev branch
6+
push:
7+
branches:
8+
- master
9+
# - feature/*
10+
# - release/*
11+
# - master
12+
13+
env:
14+
# Path to the solution file relative to the root of the project.https://github.com/farmerbriantee/AgOpenGPS/network/members
15+
SOLUTION_FILE_PATH: ./SourceCode/AgOpenGPS.sln
16+
17+
# Configuration type to build.
18+
# You can convert this to a build matrix if you need coverage of multiple configuration types.
19+
# https://docs.github.com/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
20+
BUILD_CONFIGURATION: Release
21+
22+
jobs:
23+
build:
24+
runs-on: windows-latest
25+
26+
steps:
27+
- name: Install GitVersion
28+
uses: gittools/actions/gitversion/[email protected]
29+
with:
30+
versionSpec: '6.x'
31+
32+
- name: Install 7Zip PowerShell Module
33+
shell: powershell
34+
run: Install-Module 7Zip4PowerShell -Force
35+
36+
- name: Checkout
37+
uses: actions/checkout@v2
38+
with:
39+
fetch-depth: 0
40+
41+
- name: Determine Version
42+
id: gitversion
43+
uses: gittools/actions/gitversion/[email protected]
44+
45+
- name: Display GitVersion outputs
46+
run: |
47+
echo "Major: ${{ steps.gitversion.outputs.major }}"
48+
echo "Minor: ${{ steps.gitversion.outputs.minor }}"
49+
echo "Patch: ${{ steps.gitversion.outputs.patch }}"
50+
echo "PreReleaseTag: ${{ steps.gitversion.outputs.preReleaseTag }}"
51+
echo "PreReleaseTagWithDash: ${{ steps.gitversion.outputs.preReleaseTagWithDash }}"
52+
echo "PreReleaseLabel: ${{ steps.gitversion.outputs.preReleaseLabel }}"
53+
echo "PreReleaseNumber: ${{ steps.gitversion.outputs.preReleaseNumber }}"
54+
echo "WeightedPreReleaseNumber: ${{ steps.gitversion.outputs.weightedPreReleaseNumber }}"
55+
echo "BuildMetaData: ${{ steps.gitversion.outputs.buildMetaData }}"
56+
echo "BuildMetaDataPadded: ${{ steps.gitversion.outputs.buildMetaDataPadded }}"
57+
echo "FullBuildMetaData: ${{ steps.gitversion.outputs.fullBuildMetaData }}"
58+
echo "MajorMinorPatch: ${{ steps.gitversion.outputs.majorMinorPatch }}"
59+
echo "SemVer: ${{ steps.gitversion.outputs.semVer }}"
60+
echo "LegacySemVer: ${{ steps.gitversion.outputs.legacySemVer }}"
61+
echo "LegacySemVerPadded: ${{ steps.gitversion.outputs.legacySemVerPadded }}"
62+
echo "AssemblySemVer: ${{ steps.gitversion.outputs.assemblySemVer }}"
63+
echo "AssemblySemFileVer: ${{ steps.gitversion.outputs.assemblySemFileVer }}"
64+
echo "FullSemVer: ${{ steps.gitversion.outputs.fullSemVer }}"
65+
echo "InformationalVersion: ${{ steps.gitversion.outputs.informationalVersion }}"
66+
echo "BranchName: ${{ steps.gitversion.outputs.branchName }}"
67+
echo "EscapedBranchName: ${{ steps.gitversion.outputs.escapedBranchName }}"
68+
echo "Sha: ${{ steps.gitversion.outputs.sha }}"
69+
echo "ShortSha: ${{ steps.gitversion.outputs.shortSha }}"
70+
echo "NuGetVersionV2: ${{ steps.gitversion.outputs.nuGetVersionV2 }}"
71+
echo "NuGetVersion: ${{ steps.gitversion.outputs.nuGetVersion }}"
72+
echo "NuGetPreReleaseTagV2: ${{ steps.gitversion.outputs.nuGetPreReleaseTagV2 }}"
73+
echo "NuGetPreReleaseTag: ${{ steps.gitversion.outputs.nuGetPreReleaseTag }}"
74+
echo "VersionSourceSha: ${{ steps.gitversion.outputs.versionSourceSha }}"
75+
echo "CommitsSinceVersionSource: ${{ steps.gitversion.outputs.commitsSinceVersionSource }}"
76+
echo "CommitsSinceVersionSourcePadded: ${{ steps.gitversion.outputs.commitsSinceVersionSourcePadded }}"
77+
echo "UncommittedChanges: ${{ steps.gitversion.outputs.uncommittedChanges }}"
78+
echo "CommitDate: ${{ steps.gitversion.outputs.commitDate }}"
79+
80+
81+
# - uses: paulhatch/[email protected]
82+
# id: versioning
83+
# with:
84+
# # The prefix to use to identify tags
85+
# tag_prefix: "v"
86+
# # A string which, if present in a git commit, indicates that a change represents a
87+
# # major (breaking) change, supports regular expressions wrapped with '/'
88+
# major_pattern: "(MAJOR)"
89+
# # Same as above except indicating a minor change, supports regular expressions wrapped with '/'
90+
# minor_pattern: "(MINOR)"
91+
# # A string to determine the format of the version output
92+
# format: "v${major}.${minor}.${patch}-prerelease.${increment}"
93+
# # Optional path to check for changes. If any changes are detected in the path the
94+
# # 'changed' output will true. Enter multiple paths separated by spaces.
95+
# change_path: "./SourceCode"
96+
# # Named version, will be used as suffix for name version tag
97+
# #namespace: project-b
98+
# # Indicate whether short tags like 'v1' should be supported. If false only full
99+
# # tags like 'v1.0.0' will be recognized.
100+
# short_tags: false
101+
# # If this is set to true, *every* commit will be treated as a new version.
102+
# bump_each_commit: false
103+
104+
# - name: Update AssemblyVersion and AssemblyFileVersion
105+
# run: ./SetVersion.ps1 "${{ steps.versioning.outputs.major }}.${{ steps.versioning.outputs.minor }}.${{ steps.versioning.outputs.patch }}.${{ steps.versioning.outputs.increment }}"
106+
# shell: powershell
107+
108+
- name: Update AssemblyVersion and AssemblyFileVersion
109+
run: ./SetVersion.ps1 "${{ steps.gitversion.outputs.SemVer }}"
110+
shell: powershell
111+
112+
- name: Add MSBuild to PATH
113+
uses: microsoft/setup-msbuild@v1
114+
115+
- name: Restore NuGet packages
116+
working-directory: ${{env.GITHUB_WORKSPACE}}
117+
run: nuget restore ${{env.SOLUTION_FILE_PATH}} -PackagesDirectory .\SourceCode\packages -source "https://api.nuget.org/v3/index.json"
118+
119+
- name: Build
120+
working-directory: ${{env.GITHUB_WORKSPACE}}
121+
# Add additional options to the MSBuild command line here (like platform or verbosity level).
122+
# See https://docs.microsoft.com/visualstudio/msbuild/msbuild-command-line-reference
123+
run: msbuild /m /p:Configuration=${{env.BUILD_CONFIGURATION}} ${{env.SOLUTION_FILE_PATH}}
124+
125+
- name: Directory Listing
126+
shell: cmd
127+
run: dir
128+
129+
- name: Build Artifact AgOpenGPS
130+
shell: powershell
131+
run: Compress-7Zip "AgOpenGPS_v64" -ArchiveFileName "AgOpenGPS_v64.zip" -Format Zip
132+
133+
- name: Create Release
134+
id: create_release
135+
uses: actions/create-release@latest
136+
env:
137+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
138+
with:
139+
tag_name: ${{ steps.gitversion.outputs.semVer }} ## Was: ${{ steps.versioning.outputs.version }}
140+
release_name: Release ${{ steps.gitversion.outputs.semVer }} # Was: ${{ steps.versioning.outputs.version }}
141+
body: |
142+
Automated Release by GitHub Action CI
143+
draft: false
144+
prerelease: true
145+
146+
- name: Upload Release Asset AgOpenGPS
147+
id: upload-release-asset-agopengps
148+
uses: actions/upload-release-asset@v1
149+
env:
150+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
151+
with:
152+
upload_url: ${{ steps.create_release.outputs.upload_url }}
153+
asset_path: ./AgOpenGPS_v64.zip
154+
asset_name: AgOpenGPS_v64.zip
155+
asset_content_type: application/zip

0 commit comments

Comments
 (0)