diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml new file mode 100644 index 0000000..6e85424 --- /dev/null +++ b/.github/workflows/build-and-test.yml @@ -0,0 +1,63 @@ +name: Build and test application + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + build: + runs-on: ${{ matrix.os }} + defaults: + run: + shell: bash + strategy: + fail-fast: false + matrix: + build: [linux-debug, linux-release, macos-debug, macos-release, windows-debug, windows-release] + include: + - build: linux-debug + os: ubuntu-latest + config: debug + - build: linux-release + os: ubuntu-latest + config: release + - build: macos-debug + os: macos-latest + config: debug + - build: macos-release + os: macos-latest + config: release + - build: windows-debug + os: windows-latest + config: debug + - build: windows-release + os: windows-latest + config: release + + steps: + - uses: actions/checkout@v2 + - name: Get Bindle source for testing + uses: actions/checkout@v2 + with: + repository: deislabs/bindle + path: bindleserver + ref: v0.8.0 + - name: Build Bindle + run: make build + working-directory: bindleserver + - name: Setup .NET + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 6.0.x + - name: Restore dependencies + run: dotnet restore + - name: Set MINVERBUILDMETADATA + run: echo MINVERBUILDMETADATA=$(git rev-parse --short ${GITHUB_SHA}) >> $GITHUB_ENV + - name: Build + run: dotnet build -c ${{ matrix.config }} --no-restore + - name: Test + env: + BINDLE_SERVER_PATH: ../../../../../bindleserver/target/debug + run: dotnet test -c ${{ matrix.config }} --no-build --verbosity normal diff --git a/.github/workflows/build-and-test/action.yml b/.github/workflows/build-and-test/action.yml deleted file mode 100644 index 2a6f2f9..0000000 --- a/.github/workflows/build-and-test/action.yml +++ /dev/null @@ -1,28 +0,0 @@ -name: "Build And Test Action" -description: "Builds and Tests bindle-dotnet" -inputs: - configuration: - description: 'The Configration to build and test' - required: true - default: 'release' -runs: - using: "composite" - steps: - - name: Restore dependencies - run: dotnet restore - shell: bash - - name: Set MINVERBUILDMETADATA - run: echo MINVERBUILDMETADATA=$(git rev-parse --short ${GITHUB_SHA}) >> $GITHUB_ENV - shell: bash - - name: Build - run: dotnet build -c ${{ inputs.configuration }} - shell: bash - - name: Build Bindle - run: make build - working-directory: bindleserver - shell: bash - - name: Test - env: - BINDLE_SERVER_PATH: ../../../../../bindleserver/target/debug - run: dotnet test - shell: bash diff --git a/.github/workflows/build-publish-release.yml b/.github/workflows/build-publish-release.yml deleted file mode 100644 index 03c0c77..0000000 --- a/.github/workflows/build-publish-release.yml +++ /dev/null @@ -1,139 +0,0 @@ -name: dotnet - -on: - push: - tags: - - '[0-9]+.[0-9]+.[0-9]+' - - '[0-9]+.[0-9]+.[0-9]+-preview' - branches: [ main ] - pull_request: - branches: [ main ] - -jobs: - build: - if: ${{ github.event_name == 'pull_request' }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - build: [linux-debug, linux-release, macos-debug, macos-release, windows-debug, windows-release] - include: - - build: linux-debug - os: ubuntu-latest - config: debug - - build: linux-release - os: ubuntu-latest - config: release - - build: macos-debug - os: macos-latest - config: debug - - build: macos-release - os: macos-latest - config: release - - build: windows-debug - os: windows-latest - config: debug - - build: windows-release - os: windows-latest - config: release - - steps: - - name: Fetch Source - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - name: Get Bindle source for testing - uses: actions/checkout@v2 - with: - repository: deislabs/bindle - path: bindleserver - ref: v0.8.0 - - name: Setup dotnet - uses: actions/setup-dotnet@v1 - with: - dotnet-version: 6.0.x - - uses: ./.github/workflows/build-and-test - with: - configuration: ${{ matrix.config }} - publish: - if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} - runs-on: ubuntu-latest - steps: - - name: Fetch Source - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - name: Get Bindle source for testing - uses: actions/checkout@v2 - with: - repository: deislabs/bindle - path: bindleserver - ref: main - - name: Setup dotnet - uses: actions/setup-dotnet@v1 - with: - dotnet-version: 6.0.x - - uses: ./.github/workflows/build-and-test - with: - configuration: Release - - name: Publish Github Packages - run: | - for nupkg in $(find . -name *.nupkg) - do - echo Pushing $nupkg - dotnet nuget push $nupkg --api-key ${{ secrets.GHPACKAGES_PAT }} --source https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json --skip-duplicate - done - shell: bash - release: - if: startsWith(github.ref, 'refs/tags/') - runs-on: ubuntu-latest - steps: - - name: Fetch Source - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - name: Get Bindle source for testing - uses: actions/checkout@v2 - with: - repository: deislabs/bindle - path: bindleserver - ref: main - - name: Setup dotnet - uses: actions/setup-dotnet@v1 - with: - dotnet-version: 6.0.x - - uses: ./.github/workflows/build-and-test - with: - configuration: Release - - name: "Build Changelog" - id: github_release - uses: mikepenz/release-changelog-builder-action@main - with: - configuration: ".github/workflows/configuration.json" - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Create Release - uses: actions/create-release@v1 - with: - tag_name: ${{ github.ref }} - release_name: ${{ github.ref }} - body: ${{ steps.github_release.outputs.changelog }} - prerelease: ${{ contains(github.ref, '-preview') }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Publish Github Packages - run: | - for nupkg in $(find . -name *.nupkg) - do - echo Pushing $nupkg - dotnet nuget push $nupkg --api-key ${{ secrets.GHPACKAGES_PAT }} --source https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json --skip-duplicate - done - shell: bash - - name: Publish Nuget Packages - run: | - for nupkg in $(find . -name *.nupkg) - do - echo Pushing $nupkg - dotnet nuget push $nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate - done - shell: bash diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..682997c --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,46 @@ +name: Publish packages + +on: + push: + tags: + - '[0-9]+.[0-9]+.[0-9]+' + - '[0-9]+.[0-9]+.[0-9]+-preview' + branches: [ main ] + +jobs: + publish: + runs-on: ${{ matrix.os }} + defaults: + run: + shell: bash + strategy: + fail-fast: false + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + steps: + - uses: actions/checkout@v2 + - name: Setup dotnet + uses: actions/setup-dotnet@v1 + with: + dotnet-version: 6.0.x + - name: Restore dependencies + run: dotnet restore + - name: Set MINVERBUILDMETADATA + run: echo MINVERBUILDMETADATA=$(git rev-parse --short ${GITHUB_SHA}) >> $GITHUB_ENV + - name: Build + run: dotnet build --configuration Release --no-restore + - name: Publish Github Packages + run: | + for nupkg in $(find . -name *.nupkg) + do + echo Pushing $nupkg + dotnet nuget push $nupkg --api-key ${{ secrets.GHPACKAGES_PAT }} --source https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json --skip-duplicate + done + - name: Publish Nuget Packages + if: startsWith(github.ref, 'refs/tags/') + run: | + for nupkg in $(find . -name *.nupkg) + do + echo Pushing $nupkg + dotnet nuget push $nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json --skip-duplicate + done diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..f891f83 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,29 @@ +name: Create GitHub release + +on: + push: + tags: + - '[0-9]+.[0-9]+.[0-9]+' + - '[0-9]+.[0-9]+.[0-9]+-preview' + +jobs: + release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: "Build Changelog" + id: github_release + uses: mikepenz/release-changelog-builder-action@main + with: + configuration: ".github/workflows/configuration.json" + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Create Release + uses: actions/create-release@v1 + with: + tag_name: ${{ github.ref }} + release_name: ${{ github.ref }} + body: ${{ steps.github_release.outputs.changelog }} + prerelease: ${{ contains(github.ref, '-preview') }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}