Skip to content

Merge pull request #42 from easykeys/feature/fedex/etd #14

Merge pull request #42 from easykeys/feature/fedex/etd

Merge pull request #42 from easykeys/feature/fedex/etd #14

Workflow file for this run

name: "Master CI/CD"
# Controls when the workflow will run
on:
workflow_dispatch:
push:
branches: [master]
# environment vars
env:
configuration: Release
solution: EasyKeys.Shipping.sln
# The jobs run sequentially and with dependency
jobs:
# This workflow contains dotnetcore project build.
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
outputs:
Version: ${{ steps.gitversion.outputs.nuGetVersionV2 }}
CommitsSinceVersionSource: ${{ steps.gitversion.outputs.CommitsSinceVersionSource }}
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# https://github.com/GitTools/actions
- name: Install GitVersion
uses: gittools/actions/gitversion/[email protected]
with:
versionSpec: "5.x"
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout repo
uses: actions/checkout@v2
with:
fetch-depth: 0 # to fetch all history for all tags and branches
# https://github.com/GitTools/actions/blob/main/docs/examples/github/gitversion/execute/usage-examples.md
- name: Use GitVersion
id: gitversion
uses: gittools/actions/gitversion/[email protected]
with:
useConfigFile: true
updateAssemblyInfo: false
updateAssemblyInfoFilename: false
- name: Display SemVer
run: |
echo "SemVer: $GITVERSION_SEMVER"
- name: Display GitVersion outputs
run: |
echo "ShortSha: ${{ steps.gitversion.outputs.shortSha }}"
echo "NuGetVersionV2: ${{ steps.gitversion.outputs.nuGetVersionV2 }}"
echo "VersionSourceSha: ${{ steps.gitversion.outputs.versionSourceSha }}"
echo "CommitsSinceVersionSource: ${{ steps.gitversion.outputs.commitsSinceVersionSource }}"
echo "CommitDate: ${{ steps.gitversion.outputs.commitDate }}"
# https://github.com/actions/setup-dotnet
- name: Install net7.0
uses: actions/setup-dotnet@v1
with:
dotnet-version: "7.0.x"
include-prerelease: true
- name: Clear Nuget Feeds
run: dotnet nuget locals --clear all
- name: Restore dependencies
run: dotnet restore ${{ env.solution }} -v quiet
- name: Build
run: dotnet build ${{ env.solution }} --configuration ${{ env.configuration }} --no-restore -p:Version=${{ steps.gitversion.outputs.MajorMinorPatch }}
- name: Test
run: dotnet test ./test/**/*.UnitTest.csproj --no-build --verbosity normal
- name: Package
run: dotnet pack --no-build --configuration ${{ env.configuration }} --no-restore -p:Version=${{ steps.gitversion.outputs.MajorMinorPatch }} -o packages
- name: Publish Nuget Packages
run: dotnet nuget push packages/*.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate --no-symbols
# This workflow contains
tag:
runs-on: ubuntu-latest
needs: [build]
steps:
- name: Display GitVersion outputs
run: |
echo "Version: ${{ needs.build.outputs.Version }}"
echo "CommitsSinceVersionSource: ${{ needs.build.outputs.CommitsSinceVersionSource }}"
- name: Create Tag and Release
id: create_release
uses: actions/create-release@v1
if: needs.build.outputs.CommitsSinceVersionSource > 0 # only create a release if there has been a commit
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # this token is provided by actions not need to create
with:
tag_name: ${{ needs.build.outputs.Version }}
release_name: Release ${{ needs.build.outputs.Version }}