Skip to content

UPDATE README

UPDATE README #31

Workflow file for this run

name: Build, Release, and Publish to NuGet
on:
push:
tags:
- 'v*.*.*'
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
include:
- os: ubuntu-latest
zip_command: zip -r aws-service-authenticator-linux.zip ./publish
artifact_name: aws-service-authenticator-linux.zip
- os: windows-latest
zip_command: powershell Compress-Archive -Path ./publish/* -DestinationPath aws-service-authenticator-windows.zip
artifact_name: aws-service-authenticator-windows.zip
- os: macos-latest
zip_command: zip -r aws-service-authenticator-macos.zip ./publish
artifact_name: aws-service-authenticator-macos.zip
env:
SOLUTION_PATH: AwsServiceAuthenticator.sln
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.x'
- name: Install dependencies
run: dotnet restore ${{ env.SOLUTION_PATH }}
- name: Build
run: dotnet build --configuration Release ${{ env.SOLUTION_PATH }}
- name: Publish
run: dotnet publish --configuration Release --output ./publish ${{ env.SOLUTION_PATH }}
- name: Create ZIP file
run: ${{ matrix.zip_command }}
- name: Archive release files
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.os }}
path: ${{ matrix.artifact_name }}
create_release:
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Download build artifacts (Linux)
uses: actions/download-artifact@v3
with:
name: ubuntu-latest
path: ./downloads
- name: Download build artifacts (Windows)
uses: actions/download-artifact@v3
with:
name: windows-latest
path: ./downloads
- name: Download build artifacts (macOS)
uses: actions/download-artifact@v3
with:
name: macos-latest
path: ./downloads
- name: Create a release
id: create_release
uses: softprops/action-gh-release@v1
with:
files: |
./downloads/aws-service-authenticator-linux.zip
./downloads/aws-service-authenticator-windows.zip
./downloads/aws-service-authenticator-macos.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
publish_nuget:
needs: create_release
runs-on: ubuntu-latest
environment: Personal
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.x'
- name: Restore dependencies
run: dotnet restore
- name: Build and pack
run: dotnet pack --configuration Release
- name: Debug NUGET_API_KEY
run: |
if [ -z "$NUGET_API_KEY" ]; then
echo "NUGET_API_KEY is empty."
exit 1
else
echo "NUGET_API_KEY is present."
fi
env:
NUGET_API_KEY: ${{ secrets.NUGET_ORG_API }}
- name: Publish to NuGet
env:
NUGET_API_KEY: ${{ secrets.NUGET_ORG_API }}
run: |
dotnet nuget push ./nupkg/*.nupkg \
--api-key "$NUGET_API_KEY" \
--source "https://api.nuget.org/v3/index.json"