Skip to content

Update workflow

Update workflow #187

Workflow file for this run

name: Bundle packages
on:
pull_request:
branches:
- main
- v*.*.*
push:
branches:
- main
- v*.*.*
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: ${{ !(github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/v')) }}
jobs:
env-context:
runs-on: ubuntu-latest
outputs:
is-pre-release: ${{ steps.set.outputs.is_pre_release }}
dotnet-version: ${{ steps.set.outputs.dotnet_version }}
is-version-branch: ${{ steps.set.outputs.is_version_branch }}
steps:
- name: Set env for the reusable workflows
id: set
run: |
echo "is_pre_release=$IS_PRE_RELEASE" >> $GITHUB_OUTPUT
echo "dotnet_version=$DOTNET_VERSION" >> $GITHUB_OUTPUT
if [[ ${{ github.ref }} =~ ^refs/heads/v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "is_version_branch=true" >> $GITHUB_OUTPUT
fi
LinuxBuild:
needs: env-context
uses: ./.github/workflows/unix.yml
secrets: inherit
with:
is-pre-release: ${{ fromJSON(needs.env-context.outputs.is-pre-release) }}
dotnet-version: ${{ needs.env-context.outputs.dotnet-version }}
is-version-branch: ${{ fromJSON(needs.env-context.outputs.is-version-branch) }}
WindowsBuild:
needs: env-context
uses: ./.github/workflows/windows.yml
secrets: inherit
with:
is-pre-release: ${{ fromJSON(needs.env-context.outputs.is-pre-release) }}
dotnet-version: ${{ needs.env-context.outputs.dotnet-version }}
is-version-branch: ${{ fromJSON(needs.env-context.outputs.is-version-branch) }}
MacOSBuild:
needs: env-context
uses: ./.github/workflows/macos.yml
secrets: inherit
with:
is-pre-release: ${{ fromJSON(needs.env-context.outputs.is-pre-release) }}
dotnet-version: ${{ needs.env-context.outputs.dotnet-version }}
is-version-branch: ${{ fromJSON(needs.env-context.outputs.is-version-branch) }}
TestAndPushPackages:
needs: [env-context, 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.pull_request.merged == true || github.ref == 'refs/heads/main' || fromJson(needs.env-context.outputs.is-version-branch) }}
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 }}