Skip to content

Commit

Permalink
Initial code
Browse files Browse the repository at this point in the history
  • Loading branch information
bryanknox committed Jan 4, 2024
0 parents commit 035583d
Show file tree
Hide file tree
Showing 10 changed files with 1,152 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"name": "C# .NET GitHub CLI Ext",

// For info about the dotnet dev container image see:
// https://github.com/devcontainers/images/blob/main/src/dotnet/README.md
// For a list of tag variants for the dotnet dev container images see:
// https://mcr.microsoft.com/v2/devcontainers/dotnet/tags/list
"image": "mcr.microsoft.com/vscode/devcontainers/dotnet:8.0-bookworm-slim",

// Configure tool-specific properties.
"customizations": {

// Configure properties specific to VS Code.
"vscode": {

// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"editorconfig.editorconfig",
"github.vscode-github-actions",
"github.copilot",
"github.copilot-chat",
"ms-dotnettools.csdevkit",
"ms-vscode.powershell"
]
}
},

// For available dev container features see:
// https://containers.dev/features
"features": {
"ghcr.io/devcontainers/features/github-cli:1": {}
},
"remoteUser": "vscode"
}
385 changes: 385 additions & 0 deletions .editorconfig

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Normalize line endings to LF for all text files committed into the git repo
# while leaving local line endings untouched in the working tree (local folders).
# This helps avoid problems where contributors don't all have their git config set
# to ensure text files committed use LF line endings.
# See: https://www.aleksandrhovhannisyan.com/blog/crlf-vs-lf-normalizing-line-endings-in-git/

* text=auto
89 changes: 89 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: ci/cd
on:
pull_request:
push:
branches: [main]
tags: ["v*"]

jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: 🀘 checkout
uses: actions/checkout@v3

- name: βœ“ check format
run: |
dotnet format whitespace --verify-no-changes -v:diag --exclude ~/.nuget
dotnet format style --verify-no-changes -v:diag --exclude ~/.nuget
build:
runs-on: ubuntu-latest
steps:
- name: 🀘 checkout
uses: actions/checkout@v3

- name: πŸ”§ setup-dotnet
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.x'
dotnet-quality: 'ga'

- name: πŸ”„ restore
run: dotnet restore -m:1

- name: πŸ™ build
run: dotnet build --no-restore -m:1

# - name: πŸ§ͺ test
# run: dotnet test --no-build --no-restore

- name: πŸ“¦ publish (package) artifacts
run: |
dotnet publish src/Extension.csproj -c Release -r win-x64 --self-contained -o bin/win-x64 --no-restore -p:PublishSingleFile=true /p:IncludeNativeLibrariesForSelfExtract=true
dotnet publish src/Extension.csproj -c Release -r osx-x64 --self-contained -o bin/osx-x64 --no-restore -p:PublishSingleFile=true /p:IncludeNativeLibrariesForSelfExtract=true
dotnet publish src/Extension.csproj -c Release -r osx-arm64 --self-contained -o bin/osx-arm64 --no-restore -p:PublishSingleFile=true /p:IncludeNativeLibrariesForSelfExtract=true
dotnet publish src/Extension.csproj -c Release -r linux-x64 --self-contained -o bin/linux-x64 --no-restore -p:PublishSingleFile=true /p:IncludeNativeLibrariesForSelfExtract=true
- name: ➑️ stage artifacts
run: |
mkdir -p ${{ runner.temp }}/staging
cp bin/win-x64/gh-sample-ext-csharp.exe ${{ runner.temp }}/staging/sample-ext-csharp-windows-amd64.exe
cp bin/osx-x64/gh-sample-ext-csharp ${{ runner.temp }}/staging/sample-ext-csharp-darwin-amd64
cp bin/osx-arm64/gh-sample-ext-csharp ${{ runner.temp }}/staging/sample-ext-csharp-darwin-arm64
cp bin/linux-x64/gh-sample-ext-csharp ${{ runner.temp }}/staging/sample-ext-csharp-linux-amd64
- name: ⬆️ upload artifacts
uses: actions/upload-artifact@v3
with:
name: executables
path: ${{ runner.temp }}/staging/*

publish:
runs-on: ubuntu-latest
needs: build
permissions:
contents: write
if: startsWith(github.ref, 'refs/tags/v')
steps:

- name: 🀘 checkout
uses: actions/checkout@v3

- name: ⬇️ download artifacts
uses: actions/download-artifact@v3
with:
name: executables
path: ${{ runner.temp }}/dist

- name: πŸš€ create draft release
uses: softprops/action-gh-release@v1
with:
draft: true
generate_release_notes: false
fail_on_unmatched_files: true
files: |
${{ runner.temp }}/dist/sample-ext-csharp-windows-amd64.exe
${{ runner.temp }}/dist/sample-ext-csharp-darwin-amd64
${{ runner.temp }}/dist/sample-ext-csharp-darwin-arm64
${{ runner.temp }}/dist/sample-ext-csharp-linux-amd64
Loading

0 comments on commit 035583d

Please sign in to comment.