Skip to content

Update workflow

Update workflow #168

Workflow file for this run

name: Bundle packages
on:
pull_request:
branches:
- main
- hotfix/*
push:
branches:
- main
- hotfix/*
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
DOTNET_INSTALL_DIR: ${{ github.workspace }}/.dotnet
DOTNET_VERSION: '8.0.x'
IS_PRE_RELEASE: ${{ !contains(github.ref, 'main') || !contains(github.ref, 'hotfix/') || contains(github.event.head_commit.message, '[prerelease]') }}
jobs:
LinuxBuild:
uses: ./.github/workflows/unix.yml
secrets: inherit
WindowsBuild:
uses: ./.github/workflows/windows.yml
secrets: inherit
MacOSBuild:
uses: ./.github/workflows/macos.yml
secrets: inherit
TestAndPushPackages:
needs: [LinuxBuild, WindowsBuild, MacOSBuild]
strategy:
matrix:
os: [ubuntu-latest]
defaults:
run:
working-directory: unix
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}
- name: NuGet - set credentials
uses: ./.github/actions/set-credentials
with:
api-key-github: ${{ secrets.API_KEY_GITHUB }}
api-key-nuget: ${{ secrets.API_KEY_NUGET }}
api-user-github: ${{ secrets.API_USER_GITHUB }}
api-user-nuget: ${{ secrets.API_USER_NUGET }}
- name: Setup .NET Core SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
- uses: actions/download-artifact@v4
with:
pattern: packages-*
path: nuget
- uses: actions/download-artifact@v4
with:
pattern: formats-*
path: 'tests/gdal-formats'
- name: Build bundle
run: |
make -f generate-projects-makefile generate-final-bundle BUILD_NUMBER_TAIL=${{ github.run_number }}
make -f publish-makefile pack-bundle-final PRERELEASE=${{ env.IS_PRE_RELEASE }} BUILD_NUMBER_TAIL=${{ github.run_number }}
echo "GDAL_VERSION=$(make -f publish-makefile get-gdal-version)" >> $GITHUB_ENV
echo "PACKAGES_VERSION=$(make -f publish-makefile get-package-version BUILD_NUMBER_TAIL=${{ github.run_number }})" >> $GITHUB_ENV
- name: Run tests from nuget packages
env:
TEST_PROJECT: ${{ github.workspace }}/tests/MaxRev.Gdal.Core.Tests.XUnit/MaxRev.Gdal.Core.Tests.XUnit.csproj
run: |
dotnet add ${{ env.TEST_PROJECT }} package MaxRev.Gdal.Universal --source local.ci --no-restore
dotnet remove ${{ env.TEST_PROJECT }} package MaxRev.Gdal.Core || echo "no packages to remove"
dotnet restore --ignore-failed-sources ${{ env.TEST_PROJECT }}
dotnet test --no-restore ${{ env.TEST_PROJECT }}
- name: Store packages as artifact
uses: actions/upload-artifact@v4
with:
name: packages-final
path: nuget/*.nupkg
overwrite: true
- name: Process gdal formats
working-directory: shared/scripts
run: |
python -m venv venv && source venv/bin/activate
pip install -r requirements.txt
python ./combine-formats.py '${{ github.workspace }}/tests/gdal-formats'
- name: Commit changes
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
uses: EndBug/add-and-commit@v9
with:
author_name: ${{ secrets.COMMIT_AUTHOR }}
author_email: ${{ secrets.COMMIT_EMAIL }}
message: 'List of drivers in current version [ci skip]'
add: '${{ github.workspace }}/tests/gdal-formats/**'
tag: 'v${{ env.PACKAGES_VERSION }} --force'
- name: Push packages
if: ${{ github.event_name == 'push' && (github.ref == 'refs/heads/main' || contains(github.ref, 'hotfix/')) }}
run: |
make -f push-packages-makefile PRERELEASE=${{ env.IS_PRE_RELEASE }} INCLUDE_CORE=1 \
BUILD_NUMBER_TAIL=${{ github.run_number }} API_KEY_GITHUB=${{ secrets.API_KEY_GITHUB }} API_KEY_NUGET=${{ secrets.API_KEY_NUGET }}