Skip to content

Commit

Permalink
added workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
kianzarrin committed Jun 4, 2022
1 parent 3346f71 commit 80c0db5
Show file tree
Hide file tree
Showing 2 changed files with 90 additions and 1 deletion.
83 changes: 83 additions & 0 deletions .github/workflows/Main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: Create Release

on:
push:
tags: ['*']

jobs:
build:
name: Build and Upload Release Asset

runs-on: windows-latest

env:
ModName: HideCrosswalks
Solution_File: HideCrosswalks.sln
DeployDir: Deploy/Release/bin

steps:
- name: Get Sources
uses: actions/checkout@v2
with:
submodules: true

- name: Setup Build Environment
uses: microsoft/setup-msbuild@v1

- name: Get Referenced Binaries
uses: actions/checkout@v2
with:
repository: kianzarrin/CSBinaries
ref: refs/heads/master
path: dependencies
token: ${{ secrets.CSBINARIES_REPO_PAT }}

- name: Build Solution
id: build_solution
run: |
msbuild "${{ env.Solution_File }}" /m /verbosity:normal /restore /p:Configuration=Release /p:DeployDir="$env:GITHUB_WORKSPACE/$env:DeployDir"
echo ::set-output name=ZIP_FILE::${$env:GITHUB_WORKSPACE/$env:DeployDir/../*.zip}
- name: Test vars
run: |
echo zip file is ${{ steps.build_solution.outputs.ZIP_FILE }}
echo asset name is ${{ env.ModName }}-${{ steps.get_version_number.outputs.VERSION }}.zip
- name: Get Version Number
id: get_version_number
run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\//}
shell: bash

- name: Pack Assets
id: pack_assets
run: |
$ErrorView = 'NormalView'
$env:ASSET_FILE_NAME = "${{ env.ModName }}-${{ steps.get_version_number.outputs.VERSION }}.zip"
$env:ASSET_FILE = "$env:GITHUB_WORKSPACE/$env:DeployDir/$env:ASSET_FILE_NAME"
echo "zipping $env:GITHUB_WORKSPACE/$env:DeployDir/ to $env:ASSET_FILE ..."
Compress-Archive -Path $env:GITHUB_WORKSPACE/$env:DeployDir/** -DestinationPath $env:ASSET_FILE -CompressionLevel Optimal
echo "::set-output name=ASSET_FILE::$env:ASSET_FILE"
echo "::set-output name=ASSET_FILE_NAME::$env:ASSET_FILE_NAME"
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ steps.get_version_number.outputs.VERSION }}
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 }}
asset_path: ${{ steps.pack_assets.outputs.ASSET_FILE }}
asset_name: ${{ steps.pack_assets.outputs.ASSET_FILE_NAME }}
asset_content_type: application/zip
8 changes: 7 additions & 1 deletion HideCrosswalks.sln
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@ Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29503.13
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HideCrosswalks", "HideTMPECrosswalks\HideCrosswalks.csproj", "{17034566-78DF-4C3D-BD3F-3B833CB2D872}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "HideCrosswalks", "HideTMPECrosswalks\HideCrosswalks.csproj", "{17034566-78DF-4C3D-BD3F-3B833CB2D872}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{DD26F761-832C-46ED-84BF-E4D4490FFF27}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
.github\workflows\Main.yml = .github\workflows\Main.yml
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down

0 comments on commit 80c0db5

Please sign in to comment.