Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
franmaranchello committed Apr 3, 2024
0 parents commit bd53bae
Show file tree
Hide file tree
Showing 97 changed files with 3,736 additions and 0 deletions.
102 changes: 102 additions & 0 deletions .github/workflows/prod-actions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
name: Deploy to Production

on:
push:
# this will cause the action to run on pushes to main
branches: [ "master", "main" ]
jobs:

build:

# The type of runner that the job will run on
runs-on: windows-latest
env:
SOLNAME: ZoidbergAI.Addin
SOLSLN: ZoidbergAI.Addin.sln
SOLDLL: ZoidbergAI.Addin.dll
INSTALLER_SETUP_FILE_PATH: Installer\InstallScript.iss
SETUP_EXE_PATH: Installer\Installer\ZoidbergAI.Addin.exe
CERTIFICATE_URL: "https://i2fy7wt5qd.execute-api.us-east-1.amazonaws.com/dev/everse"
CERTIFICATE_KEY: ${{ secrets.EVERSE_AWS_S3_CERTIFICATE_KEY_ID }}
CERTIFICATE_PASSWORD: ${{ secrets.EVERSE_CERTIFICATE_KEY }}
outputs:
Version: ${{ steps.gitversion.outputs.nuGetVersionV2 }}
CommitsSinceVersionSource: ${{ steps.gitversion.outputs.CommitsSinceVersionSource }}

steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

# install and calculate the new version with GitVersion
- name: Install GitVersion
uses: gittools/actions/gitversion/setup@v0
with:
versionSpec: '5.x'

- name: Determine Version
uses: gittools/actions/gitversion/execute@v0
with:
useConfigFile: true
configFilePath: GitVersion.yml

id: gitversion # step id used as reference for output values
- name: Display GitVersion outputs
run: |
echo "MajorMinorPatch: ${{ steps.gitversion.outputs.majorMinorPatch }}"
echo "NuGetVersionV2: ${{ steps.gitversion.outputs.nuGetVersionV2 }}"
echo "CommitsSinceVersionSource: ${{ steps.gitversion.outputs.CommitsSinceVersionSource }}"
# Installing the MSBuild
- name: Setup MSBuild Path
uses: microsoft/[email protected]

# Install and restore the necessary NuGet packages
- name: Setup NuGet
uses: NuGet/[email protected]

- name: Restore NuGet Packages
run: nuget restore ${{ env.SOLSLN }}

# Change the version inside of the 'InstallScript.iss' file
- name: Setting new version to the 'InstallScript.iss' file
run: (Get-Content ${{ env.INSTALLER_SETUP_FILE_PATH }}) -replace 'AppVersion=1.0.0', 'AppVersion=v${{ steps.gitversion.outputs.majorMinorPatch }}' | Out-File -encoding ASCII ${{ env.INSTALLER_SETUP_FILE_PATH }}

- name: Get certificate
run: |
$url = ${{ env.CERTIFICATE_URL }}
$outputFilePath = "credentials.pfx"
$apiKey = "${{ env.CERTIFICATE_KEY }}"
$headers = @{
"x-api-key" = $apiKey
}
Invoke-RestMethod -Uri $url -Headers $headers -OutFile $outputFilePath
# Build the solution on the Release mode
- name: Build and Publish App
run: msbuild ${{ env.SOLSLN }} /t:Clean,Build /p:platform="Any CPU" /p:Configuration=Release /p:DeployOnBuild=true /p:PublishProfile=FolderProfile -m

- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
with:
tag_name: ${{ steps.gitversion.outputs.majorMinorPatch }}
release_name: ${{ env.SOLNAME }} v${{ steps.gitversion.outputs.majorMinorPatch }}
draft: false
prerelease: false

- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ${{ env.SETUP_EXE_PATH }}
asset_name: ${{ env.SOLNAME }}-${{ steps.gitversion.outputs.majorMinorPatch }}.exe
asset_content_type: application/zip
68 changes: 68 additions & 0 deletions .github/workflows/pull-request-actions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: Pull request

on:
pull_request:
# we'll also run this when pull requests to develop are opened
branches: [ develop, test/*, feature/*, docs/*, bug/*, task/* , improvement/*, "master", "main"]
jobs:

build:

# The type of runner that the job will run on
runs-on: windows-latest
env:
SOLNAME: ZoidbergAI.Addin
SOLSLN: ZoidbergAI.Addin.sln
SOLDLL: ZoidbergAI.Addin.dll
INSTALLER_SETUP_FILE_PATH: Installer\InstallScript.iss
SETUP_EXE_PATH: Installer\Installer\ZoidbergAI.Addin.exe
CERTIFICATE_URL: "https://i2fy7wt5qd.execute-api.us-east-1.amazonaws.com/dev/everse"
CERTIFICATE_KEY: ${{ secrets.EVERSE_AWS_S3_CERTIFICATE_KEY_ID }}
CERTIFICATE_PASSWORD: ${{ secrets.EVERSE_CERTIFICATE_KEY }}
outputs:
Version: ${{ steps.gitversion.outputs.nuGetVersionV2 }}
CommitsSinceVersionSource: ${{ steps.gitversion.outputs.CommitsSinceVersionSource }}

steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0

# Installing the MSBuild
- name: Setup MSBuild Path
uses: microsoft/[email protected]

# Install and restore the necessary NuGet packages
- name: Setup NuGet
uses: NuGet/[email protected]

- name: Restore NuGet Packages
run: nuget restore ${{ env.SOLSLN }}

# Change the version inside of the 'InstallScript.iss' file
- name: Setting new version to the 'InstallScript.iss' file
run: (Get-Content ${{ env.INSTALLER_SETUP_FILE_PATH }}) -replace 'AppVersion=1.0.0', 'AppVersion=v${{ steps.gitversion.outputs.majorMinorPatch }}' | Out-File -encoding ASCII ${{ env.INSTALLER_SETUP_FILE_PATH }}

- name: Get certificate
run: |
$url = ${{ env.CERTIFICATE_URL }}
$outputFilePath = "credentials.pfx"
$apiKey = "${{ env.CERTIFICATE_KEY }}"
$headers = @{
"x-api-key" = $apiKey
}
Invoke-RestMethod -Uri $url -Headers $headers -OutFile $outputFilePath
# Build the solution on the Release mode
- name: Build and Publish App
run: msbuild ${{ env.SOLSLN }} /t:Clean,Build /p:platform="Any CPU" /p:Configuration=Release /p:DeployOnBuild=true /p:PublishProfile=FolderProfile

- name: 'Upload Artifact'
uses: actions/upload-artifact@v3
with:
name: installer
path: "${{ env.SETUP_EXE_PATH }}"
retention-days: 5
Loading

0 comments on commit bd53bae

Please sign in to comment.