|
| 1 | +name: Continuous integration |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - 'main' |
| 7 | + - 'add-github-action' |
| 8 | + workflow_dispatch: |
| 9 | +jobs: |
| 10 | + build_test_pack: |
| 11 | + name: Build, test & pack |
| 12 | + runs-on: windows-latest |
| 13 | + env: |
| 14 | + buildConfiguration: release |
| 15 | + outputs: # https://stackoverflow.com/questions/59175332/using-output-from-a-previous-job-in-a-new-one-in-a-github-action |
| 16 | + Version: ${{ steps.gitversion.outputs.nuGetVersionV2 }} |
| 17 | + CommitsSinceVersionSource: ${{ steps.gitversion.outputs.CommitsSinceVersionSource }} |
| 18 | + steps: |
| 19 | + - name: Checkout repository |
| 20 | + uses: actions/checkout@v2 |
| 21 | + with: |
| 22 | + fetch-depth: 0 #fetch-depth is needed for GitVersion |
| 23 | + |
| 24 | + # install and calculate the new version with GitVersion |
| 25 | + - name: Install GitVersion |
| 26 | + uses: gittools/actions/gitversion/[email protected] |
| 27 | + with: |
| 28 | + versionSpec: '5.x' |
| 29 | + - name: Determine Version |
| 30 | + uses: gittools/actions/gitversion/[email protected] |
| 31 | + id: gitversion # step id used as reference for output values |
| 32 | + - name: Display GitVersion outputs |
| 33 | + run: | |
| 34 | + echo "MajorMinorPatch: ${{ steps.gitversion.outputs.majorMinorPatch }}" |
| 35 | + echo "NuGetVersionV2: ${{ steps.gitversion.outputs.nuGetVersionV2 }}" |
| 36 | + echo "CommitsSinceVersionSource: ${{ steps.gitversion.outputs.CommitsSinceVersionSource }}" |
| 37 | + |
| 38 | + - name: Setup .NET Core @ Latest |
| 39 | + uses: actions/setup-dotnet@v1 |
| 40 | + - name: Build |
| 41 | + run: dotnet build --configuration $env:buildConfiguration -p:Version=${{ steps.gitversion.outputs.nuGetVersionV2 }} |
| 42 | + - name: Create Release |
| 43 | + id: create_release |
| 44 | + uses: actions/create-release@v1 |
| 45 | + env: |
| 46 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token |
| 47 | + with: |
| 48 | + tag_name: v${{ steps.gitversion.outputs.nuGetVersionV2 }} |
| 49 | + release_name: EPi.Source.Updater.${{ steps.gitversion.outputs.nuGetVersionV2 }} |
| 50 | + draft: false |
| 51 | + prerelease: false |
| 52 | + - name: upload windows artifact |
| 53 | + uses: actions/upload-release-asset@v1 |
| 54 | + env: |
| 55 | + GITHUB_TOKEN: ${{ github.token }} |
| 56 | + with: |
| 57 | + upload_url: ${{ steps.create_release.outputs.upload_url }} |
| 58 | + asset_path: ./src/EpiSourceUpdater/bin/Release\netstandard2.0/Epi.Source.Updater.zip |
| 59 | + asset_name: EPi.Source.Updater.${{ steps.gitversion.outputs.nuGetVersionV2 }}.zip |
| 60 | + asset_content_type: application/zip |
| 61 | + |
0 commit comments