Pack #9
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: 'Pack' | |
on: | |
workflow_run: | |
workflows: [ 'Build and Test' ] | |
types: [ requested ] | |
branches: [ master ] | |
workflow_call: | |
workflow_dispatch: | |
inputs: | |
reason: | |
description: 'The reason for running the workflow' | |
required: false | |
default: 'Manual pack' | |
version: | |
description: 'Version' | |
required: true | |
env: | |
CONFIGURATION: 'Release' | |
PROJECT_PATH: "." | |
PROJECT_NAME: redmine-net-api | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} | |
cancel-in-progress: true | |
jobs: | |
pack: | |
name: Pack | |
if: github.ref == 'refs/heads/master' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Determine Version | |
run: | | |
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then | |
echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_ENV | |
else | |
echo "VERSION=$(git describe --tags `git rev-list --tags --max-count=1`)" >> $GITHUB_ENV | |
fi | |
echo "$GITHUB_ENV" | |
- name: Print Version | |
run: | | |
echo "$VERSION" | |
- name: Validate Version matches SemVer format | |
run: | | |
if [[ ! "$VERSION" =~ ^([0-9]+\.){2}[0-9]+(-[\w.]+)?$ ]]; then | |
echo "The version does not match the SemVer format (X.Y.Z). Please provide a valid version." | |
exit 1 | |
fi | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
lfs: true | |
fetch-depth: 0 | |
- name: Setup .NET Core (global.json) | |
uses: actions/setup-dotnet@v4 | |
- name: Install dependencies | |
run: dotnet restore "${{ env.PROJECT_PATH }}" | |
- name: Pack | |
run: >- | |
dotnet pack ./src/redmine-net-api/redmine-net-api.csproj | |
--output ./artifacts | |
--configuration "${{ env.CONFIGURATION }}" | |
-p:Version=$VERSION | |
-p:PackageVersion=${{ env.VERSION }} | |
-p:SymbolPackageFormat=snupkg | |
- name: Pack Signed | |
run: >- | |
dotnet pack ./src/redmine-net-api/redmine-net-api.csproj | |
--output ./artifacts | |
--configuration "${{ env.CONFIGURATION }}" | |
--include-symbols | |
--include-source | |
-p:Version=$VERSION | |
-p:PackageVersion=${{ env.VERSION }} | |
-p:SymbolPackageFormat=snupkg | |
-p:Sign=true | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: artifacts | |
path: ./artifacts |