Skip to content

Commit

Permalink
feat: updated azure search (#54)
Browse files Browse the repository at this point in the history
feat: updated Azure Search + refactor
  • Loading branch information
aochmann authored May 13, 2021
1 parent d4d6473 commit 97c2508
Show file tree
Hide file tree
Showing 124 changed files with 2,983 additions and 2,167 deletions.
121 changes: 121 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
name: Build

on:
workflow_run:
workflows: [ "Changelog generator" ]
types:
- completed
workflow_dispatch:

jobs:
build:
name: Build
runs-on: windows-latest
env:
# Dotnet Setup
DOTNET_VERSION: 3.1.401

# Stop wasting time caching packages
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true

# Disable sending usage data to Microsoft
DOTNET_CLI_TELEMETRY_OPTOUT: true

# Solution Setup
CONFIG: 'Release'
PROJECT_NAME: 'Cogworks.AzureSearch'
VERSION: '1.0.0'
SOURCE_PATH: './Source'

# Nuget Setup
NUGET_VERSION: 'latest'
NUGET_OUTPUT: '.output/'

steps:
- name: Checkout reference commit
if: ${{ github.event_name == 'pull_request' }}
uses: actions/checkout@v2

- name: Checkout master
if: ${{ github.event_name != 'pull_request' }}
uses: actions/checkout@v2
with:
ref: master
fetch-depth: 0

- name: Get version
if: ${{ github.event_name != 'pull_request' }}
shell: bash
run: |
tag_check=$(git describe --exact-match `git rev-parse HEAD` | head -1)
echo "VERSION=$tag_check" >> $GITHUB_ENV
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v1

- name: Setup .NET Core
uses: actions/setup-dotnet@v1
with:
dotnet-version: ${{ env.DOTNET_VERSION }}

- name: Configure NuGet
uses: nuget/setup-nuget@v1
with:
nuget-version: ${{ env.NUGET_VERSION }}

- name: NuGet Restore
shell: powershell
working-directory: ${{ github.workspace }}
run: |
$solutions = Get-ChildItem -Path ${{ env.SOURCE_PATH}} -Recurse -Include *.sln
foreach ($solutionFile in $solutions){
nuget restore "$solutionFile"
}
- name: Install Dependencies
shell: powershell
working-directory: ${{ github.workspace }}
run: |
$solutions = Get-ChildItem -Path ${{ env.SOURCE_PATH}} -Recurse -Include *.sln
foreach ($solutionFile in $solutions){
dotnet restore "$solutionFile"
}
- name: Build
shell: powershell
working-directory: ${{ github.workspace }}
run: |
$solutions = Get-ChildItem -Path ${{ env.SOURCE_PATH}} -Recurse -Include *.sln
foreach ($solutionFile in $solutions){
msbuild.exe "$solutionFile" `
/p:Configuration=${{ env.CONFIG }} `
/p:DeployOnBuild=false `
/p:SkipInvalidConfigurations=true `
/p:TransformWebConfigEnabled=False `
/p:AutoParameterizationWebConfigConnectionStrings=False `
/p:MarkWebConfigAssistFilesAsExclude=False
}
- name: Pack all nuspec files
if: ${{ github.event_name != 'pull_request' }}
shell: powershell
working-directory: ${{ github.workspace }}
run: |
$nuspecFiles = Get-ChildItem -Path ${{ env.SOURCE_PATH}} -Recurse -Include *.nuspec
foreach ($nuspecFile in $nuspecFiles){
nuget pack "$nuspecFile" `
-Version ${{ env.VERSION }} `
-Properties Configuration=${{ env.CONFIG }} `
-OutputDirectory ${{ env.NUGET_OUTPUT }}
}
- name: Upload build artifact
if: ${{ github.event_name != 'pull_request' }}
uses: actions/upload-artifact@v2
with:
name: build_${{ env.PROJECT_NAME }}.${{ env.VERSION }}
path: ${{ github.workspace }}/${{ env.NUGET_OUTPUT }}
85 changes: 85 additions & 0 deletions .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: Changelog generator

on:
push:
tags:
- '*'

jobs:
changelog_generator:
name: Changelog Generator
runs-on: ubuntu-latest
env:
branch: master
CONVENTIONAL_GITHUB_RELEASER_TOKEN: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Set local user
run: |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
- name: Get tag branch
run: |
branch_check=$(git branch -r --contains $(git rev-parse $GITHUB_REF~0) | sed 's/remotes\/origin\///' | sed 's/origin\///' | sed 's/develop//' | sed 's/* //' | sed -r '/^\s*$/d' | head -1)
echo $branch_check
if [[ $branch_check =~ ^(release|master)$ ]]; then
echo "Not correct branch. Allowed branches release and master."
exit 1
fi
echo "branch=$branch_check" >> $GITHUB_ENV
- uses: actions/checkout@v2
name: Checkout tag branch
with:
fetch-depth: 0
ref: ${{ env.branch }}

- name: Get tag
run: |
echo "Describe: $(git describe)"
echo "Rev parse: $(git rev-parse $GITHUB_REF~0)"
tag_check=$(git describe --exact-match `git rev-parse $GITHUB_REF~0`)
echo "tag=$tag_check" >> $GITHUB_ENV
- name: Install dependencies
run: |
rm -rf node_modules
npm install
- name: Generate changelog and update npm version
run: |
npm run release
- name: Remove tag
run: |
git tag -d ${{ env.tag }}
- name: Updating tags
run: |
git pull "https://$GITHUB_ACTOR:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY.git" master
git tag -a ${{ env.tag }} -m "${{ env.tag }}"
git push "https://$GITHUB_ACTOR:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY.git" --tag -f
- name: Pushing latest changes to master
run: |
git pull "https://$GITHUB_ACTOR:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY.git" master
git push "https://$GITHUB_ACTOR:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY.git" ${{ env.branch }}:master
- name: Checkout master
run: |
git checkout master
git pull "https://$GITHUB_ACTOR:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY.git" master
- name: Generate GitHub release notes
run: |
npm run github-release
continue-on-error: true
54 changes: 54 additions & 0 deletions .github/workflows/gitflow.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Git Flow

on:
workflow_run:
workflows: [ "Changelog generator" ]
types:
- completed
jobs:
gitflow:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
name: Git Flow
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
with:
ref: master
fetch-depth: 0

- name: Set local user
run: |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
- name: Get latest tag
run: |
tag_check=$(git describe --exact-match `git rev-parse HEAD` | head -1)
echo "tag=$tag_check" >> $GITHUB_ENV
- name: Clear release branch
run: |
branch_check=$(git branch -r | grep release/${{ env.tag }} | sed 's/remotes\/origin\///' | sed 's/origin\///' | sed 's/* //' | sed -r '/^\s*$/d' | head -1)
if [[ $branch_check ]]; then
git push "https://$GITHUB_ACTOR:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY.git" --delete $branch_check
fi
- name: Checkout develop and pull latest develop
run: |
git checkout develop
git pull "https://$GITHUB_ACTOR:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY.git" develop
- name: Pull master into develop
run: |
Conflicts=$(git pull "https://$GITHUB_ACTOR:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY.git" master -q --ff || echo "fatal: Not possible to fast-forward, aborting")
AbortingMsg='aborting'
if [[ "$Conflicts" == *"$AbortingMsg"* ]]; then
exit 1
fi
- name: Pushing develop to origin if pulling successfully
if: success()
run: |
git push "https://$GITHUB_ACTOR:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY.git" develop:develop
49 changes: 49 additions & 0 deletions .github/workflows/release-github.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: (NuGet) GitHub Packages Release

on:
workflow_run:
workflows: [ "Build" ]
types:
- completed
jobs:
github_packages_release:
name: GitHub Packages Release
if: ${{ github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event != 'pull_request' }}
runs-on: ubuntu-latest
env:
# GitHub Packages Feed settings
GITHUB_USER: thecogworks
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_FEED: https://nuget.pkg.github.com/thecogworks
GITHUB_PACKAGES_OUTPUT: ${{ github.workspace }}/github_packages

# Project Setup
PROJECT_NAME: 'Cogworks.AzureSearch'

steps:
- name: Checkout master
uses: actions/checkout@v2
with:
ref: master
fetch-depth: 0

- name: Get version
shell: bash
run: |
tag_check=$(git describe --exact-match `git rev-parse HEAD` | head -1)
echo "VERSION=$tag_check" >> $GITHUB_ENV
- name: Download a single artifact
uses: aochmann/actions-download-artifact@1.0.2
with:
name: build_${{ env.PROJECT_NAME }}.${{ env.VERSION }}
path: ${{ env.GITHUB_PACKAGES_OUTPUT }}

- name: Push to GitHub Feed
shell: bash
working-directory: ${{ env.GITHUB_PACKAGES_OUTPUT }}
run: |
for nugetFile in ./*.nupkg
do
curl -vX PUT -u "$GITHUB_USER:$GITHUB_TOKEN" -F package=@$nugetFile $GITHUB_FEED
done
54 changes: 54 additions & 0 deletions .github/workflows/release-nuget.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: (NuGet) NuGet Release

on:
workflow_run:
workflows: [ "Build" ]
types:
- completed
jobs:
nuget_release:
name: NuGet Release
if: ${{ github.event.workflow_run.conclusion == 'success' && github.event.workflow_run.event != 'pull_request' }}
runs-on: ubuntu-latest
env:
# Nuget Setup
NUGET_VERSION: 'latest'
NUGET_OUTPUT: ${{ github.workspace }}/nuget/
NUGET_TOKEN: ${{ secrets.NUGET_TOKEN }}
NUGET_FEED: https://api.nuget.org/v3/index.json

# Project Setup
PROJECT_NAME: 'Cogworks.AzureSearch'

steps:
- name: Checkout master
uses: actions/checkout@v2
with:
ref: master
fetch-depth: 0

- name: Get version
shell: bash
run: |
tag_check=$(git describe --exact-match `git rev-parse HEAD` | head -1)
echo "VERSION=$tag_check" >> $GITHUB_ENV
- name: Download a single artifact
uses: aochmann/actions-download-artifact@1.0.2
with:
name: build_${{ env.PROJECT_NAME }}.${{ env.VERSION }}
path: ${{ env.NUGET_OUTPUT }}

- name: Configure NuGet
uses: nuget/setup-nuget@v1
with:
nuget-version: ${{ env.NUGET_VERSION }}

- name: Push to NuGet Feed
shell: bash
working-directory: ${{ env.NUGET_OUTPUT }}
run: |
for nugetFile in ./*.nupkg
do
nuget push $nugetFile ${{ env.NUGET_TOKEN }} -Source ${{ env.NUGET_FEED }}
done
Loading

0 comments on commit 97c2508

Please sign in to comment.