Skip to content

Commit

Permalink
Merge branch 'master' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
gerardog committed Sep 5, 2022
2 parents 567bd62 + 4461839 commit 5ed06bc
Show file tree
Hide file tree
Showing 54 changed files with 1,517 additions and 723 deletions.
2 changes: 1 addition & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1 @@
*.md eol=lf
* -text
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/.github/ @gerardog
/build/ @gerardog
95 changes: 95 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name: CI Build

on:
push:
branches:
- '**'
tags-ignore:
- '**'
workflow_call:
outputs:
version:
description: "Version"
value: ${{ jobs.build.outputs.version }}
version_MajorMinorPatch:
description: "Version (without prerelease tag)"
value: ${{ jobs.build.outputs.version_MajorMinorPatch }}

jobs:
test:
name: Test
runs-on: windows-latest
permissions:
id-token: write
contents: read
checks: write
steps:
- uses: actions/setup-dotnet@v2
with:
dotnet-version: '7.0.x'
include-prerelease: true
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Run Tests
run: ./build/02-test.ps1
- name: Test Report DotNet
uses: dorny/test-reporter@v1
if: success() || failure() # run this step even if previous step failed
with:
name: TestsResults (dotnet)
path: "**/TestResults*.trx"
reporter: dotnet-trx
fail-on-error: false
- name: Test Report PowerShell v5
uses: zyborg/[email protected] # https://github.com/zyborg/pester-tests-report#inputs
if: success() || failure() # run this step even if previous step failed
with:
test_results_path: ./testResults_PS5.xml
report_name: TestResults PowerShell v5.x
report_title: PowerShell v5 Tests
github_token: ${{ secrets.GITHUB_TOKEN }}

- name: Test Report PowerShell v7
uses: zyborg/[email protected] # https://github.com/zyborg/pester-tests-report#inputs
if: success() || failure() # run this step even if previous step failed
with:
test_results_path: ./testResults_PS7.xml
report_name: TestResults PowerShell Core (v7.x)
report_title: PowerShell v7 Tests
github_token: ${{ secrets.GITHUB_TOKEN }}
# - uses: OrbitalOwen/[email protected]
# if: always()
# with:
# file-name: 'desktop.jpg'

build:
name: Build
runs-on: windows-latest
steps:
- uses: actions/setup-dotnet@v2
with:
dotnet-version: '7.0.x'
include-prerelease: true
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Install dependencies
run: choco install GitVersion.Portable ilmerge --confirm --no-progress
- name: Update project version
run: gitversion /l console /output buildserver /updateAssemblyInfo /verbosity minimal
- name: Get project version
id: getversion
run: |
echo "::set-output name=version::$(gitversion /showvariable LegacySemVer)"
echo "::set-output name=version_MajorMinorPatch::$(gitversion /showvariable MajorMinorPatch)"
- name: Build
run: ./build/01-build.ps1
- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: Binaries
path: ./artifacts
outputs:
version: ${{ steps.getversion.outputs.version }}
version_MajorMinorPatch: ${{ steps.getversion.outputs.version_MajorMinorPatch }}
41 changes: 0 additions & 41 deletions .github/workflows/deploy.yml

This file was deleted.

51 changes: 51 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Docs Build & Deploy

on:
push:
branches:
- master
- docs
paths:
- 'docs/**'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow one concurrent deployment
concurrency:
group: "pages"
cancel-in-progress: true

jobs:
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16.x
cache: yarn
cache-dependency-path: '**/yarn.lock'
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Build website
run: yarn build
- name: Setup Pages
uses: actions/configure-pages@v2
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
# Upload entire repository
path: './docs/build'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
103 changes: 103 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
name: Release

on:
push:
tags:
- 'v*'

jobs:
build:
uses: ./.github/workflows/ci.yml
permissions:
id-token: write
contents: read
checks: write

release:
name: Sign & Release to GitHub
#if: github.ref == 'refs/heads/master' && github.repository == 'gerardog/gsudo'
if: github.repository == 'gerardog/gsudo'
runs-on: windows-latest
environment:
name: release-github
needs: build
env:
cert_path: "C:\\secret\\cert.pfx"
cert_key: ${{ secrets.P_F_X_Key }}
version: ${{ needs.build.outputs.version }}
version_MajorMinorPatch: ${{ needs.build.outputs.version_MajorMinorPatch }}
permissions:
contents: write
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/download-artifact@v3
with:
name: Binaries
path: ./artifacts
- name: Decode certificate
# First encode and upload as environment secret using: [convert]::ToBase64String((Get-Content .\code_signing.pfx -AsByteStream))
run: |
$pfx_cert_byte = [System.Convert]::FromBase64String("${{ secrets.p_f_x }}")
$_ = mkdir (split-path -parent $env:cert_path) -ErrorAction Ignore
[IO.File]::WriteAllBytes("$env:cert_path", $pfx_cert_byte)
- name: Code Sign
run: ./build/03-sign.ps1
- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: Binaries
path: ./artifacts
- name: Package for GitHub Release
run: ./build/04-release-GitHub.ps1
- name: Remove the pfx
run: Remove-Item -path $env:cert_path
- name: Upload installer artifacts
uses: actions/upload-artifact@v3
with:
name: Installer
path: ./artifacts/gsudoSetup.msi
- name: Create Release
uses: ncipollo/[email protected]
with:
artifacts: "artifacts/*.*"
token: ${{ secrets.GITHUB_TOKEN }}
draft: true
prerelease: true
generateReleaseNotes: true
name: gsudo v${{env.version}}
tag: v${{env.version}}
commit: ${{env.GITHUB_SHA}}
allowUpdates: true
omitBodyDuringUpdate: true
replacesArtifacts: true

chocolatey:
name: Pack & Release to Chocolatey
#if: github.ref == 'refs/heads/master' && github.repository == 'gerardog/gsudo'
if: github.repository == 'gerardog/gsudo'
runs-on: windows-latest
needs: [build, release]
environment:
name: release-chocolatey
env:
version: ${{ needs.build.outputs.version }}
version_MajorMinorPatch: ${{ needs.build.outputs.version_MajorMinorPatch }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/download-artifact@v3
with:
name: Binaries
path: ./artifacts
- name: Import Chocolatey Api Key
run: choco apikey --key ${{ secrets.CHOCOLATEY_APIKEY }} --source https://push.chocolatey.org/
- name: Build Package for Chocolatey & Upload
run: ./build/05-release-Chocolatey.ps1
- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: Binaries
path: ./artifacts
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ bld/
[Bb]in/
[Oo]bj/
[Ll]og/
artifacts/
TestResult*

# Visual Studio 2015/2017 cache/options directory
.vs/
Expand Down
Loading

0 comments on commit 5ed06bc

Please sign in to comment.