Deploy FolderFlex #32
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 FolderFlex | |
on: | |
push: | |
branches: ['master'] | |
paths-ignore: | |
- 'README.md' | |
- 'social_preview.jpg' | |
- 'docs/**' | |
- '.github/workflows/dotnet-desktop.yml' | |
- 'dotnet-desktop.yml' | |
workflow_dispatch: | |
permissions: | |
contents: write | |
jobs: | |
build: | |
strategy: | |
matrix: | |
configuration: [Release] | |
runs-on: windows-latest | |
steps: | |
- name: Sincronizando Repositório | |
uses: actions/checkout@v4 | |
- name: Configurando Ambiente .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: '8.0.x' | |
- name: Restaurando Dependências do .NET (Cache) | |
uses: actions/cache@v3 | |
with: | |
path: | | |
~/.nuget/packages | |
~/.dotnet | |
key: ${{ runner.os }}-dotnet-${{ hashFiles('**/*.csproj', '**/*.sln') }} | |
restore-keys: | | |
${{ runner.os }}-dotnet- | |
- name: Restaurando as dependências | |
run: dotnet restore FolderFlex.sln | |
- name: Compilando Tudo | |
run: dotnet build FolderFlex.sln --configuration ${{ matrix.configuration }} --no-restore /p:WarningLevel=0 | |
- name: Publicando FolderFlex | |
run: dotnet publish FolderFlex/FolderFlex.csproj --configuration ${{ matrix.configuration }} --output ./output/ | |
- name: Assembly do arquivo .csproj | |
id: get_version | |
run: | | |
[xml]$csproj = Get-Content "FolderFlex/FolderFlex.csproj" | |
$version = $csproj.Project.PropertyGroup.AssemblyVersion | |
if ($version -and $version.Trim()) { | |
$version = $version.Trim() | |
} else { | |
$version = $csproj.Project.PropertyGroup.FileVersion | |
if ($version -and $version.Trim()) { | |
$version = $version.Trim() | |
} else { | |
$version = "0.0.0.0" # Valor padrão | |
} | |
} | |
echo "Version found: $version" | |
echo "VERSION=$version" >> $GITHUB_ENV | |
- name: Criando Pasta para os Arquivos | |
run: | | |
mkdir ./output/FolderFlexFiles | |
- name: Movendo Arquivos para a Nova Pasta | |
run: | | |
Get-ChildItem ./output/ | Where-Object { $_.Name -ne 'FolderFlexFiles' } | Move-Item -Destination ./output/FolderFlexFiles/ -Force | |
- name: Compactando a Pasta | |
run: | | |
powershell Compress-Archive -Path ./output/FolderFlexFiles -DestinationPath ./output/FolderFlex.zip | |
- name: Criando Tag da versão | |
id: tag_version | |
run: | | |
git config --global user.name "GitHub Actions" | |
git config --global user.email "github-actions@github.com" | |
git tag "v${{ env.VERSION }}" | |
git push origin "v${{ env.VERSION }}" | |
- name: Criando Nova Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: "v${{ env.VERSION }}" | |
release_name: "FolderFlex v${{ env.VERSION }}" | |
draft: false | |
prerelease: true | |
- name: Anexando o artefato à release | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ./output/FolderFlex.zip | |
asset_name: FolderFlex.zip | |
asset_content_type: application/zip |