Build #47
Workflow file for this run
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: Build | |
on: | |
create: | |
tags: | |
- 'v[0-9]+.[0-9]+.[0-9]+.*' | |
push: | |
branches: | |
- '*' | |
tags: | |
- 'v[0-9]+.[0-9]+.[0-9]+.*' | |
pull_request: | |
workflow_dispatch: | |
env: | |
VERSION: 0.0.0 | |
ConnectionStrings__Test: ${{ secrets.TEST_CONNECTION_STRING }} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.ref }} # This checks out the commit that triggered the workflow run | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: '8.0.x' | |
- name: Set the version | |
if: startsWith(github.ref, 'refs/tags/v') | |
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV | |
- name: Print the version | |
run: echo $VERSION | |
- name: Restore dependencies | |
run: dotnet restore | |
- name: Build | |
run: dotnet build --no-restore --configuration Release /p:Version=${{ env.VERSION }} /p:CopyrightYear=$(date +%Y) | |
- name: Test (latest pgmq version) | |
run: Npgmq.Test/scripts/run-tests.sh | |
- name: Test (pgmq 1.1.1) | |
run: Npgmq.Test/scripts/run-tests.sh 1.1.1 | |
- name: Test (pgmq 1.0.0) | |
run: Npgmq.Test/scripts/run-tests.sh 1.0.0 | |
- name: Test (pgmq 0.31.0) | |
run: Npgmq.Test/scripts/run-tests.sh 0.31.0 | |
- name: Pack | |
if: startsWith(github.ref, 'refs/tags/v') | |
run: dotnet pack Npgmq/Npgmq.csproj --no-build --configuration Release /p:PackageVersion=${{ env.VERSION }} /p:CopyrightYear=$(date +%Y) --output out | |
- uses: actions/upload-artifact@v4 | |
if: startsWith(github.ref, 'refs/tags/v') | |
with: | |
name: build-artifact | |
path: out | |
publish: | |
needs: build | |
if: startsWith(github.ref, 'refs/tags/v') | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
name: build-artifact | |
path: out | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: '8.0.x' | |
- name: Push | |
run: dotnet nuget push "out/*.nupkg" --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json |