Removed bundle and added it to .gitignore. #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |