diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 75a5b90c..505e067b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -6,27 +6,65 @@ on: - 'v*.*.*' # Trigger on version tags jobs: - release: - runs-on: ubuntu-latest + build: + strategy: + matrix: + include: + - os: ubuntu-latest + artifact_os: ubuntu + binary_path: sipnet + - os: macos-latest + artifact_os: macos + binary_path: sipnet + runs-on: ${{ matrix.os }} steps: - # Checkout the repository - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v4 - # Build SIPNET binary - name: Build SIPNET run: make + shell: bash + + - name: Prepare release binary + shell: bash + run: | + tag="${GITHUB_REF_NAME}" + src="${{ matrix.binary_path }}" + dest="sipnet-${{ matrix.artifact_os }}-${tag}" + + if [ ! -f "$src" ]; then + echo "Expected build artifact '${src}' not found" >&2 + exit 1 + fi + + mkdir -p dist + mv "$src" "dist/${dest}" + + - name: Upload release artifact + uses: actions/upload-artifact@v4 + with: + name: sipnet-${{ github.ref_name }}-${{ matrix.artifact_os }} + path: dist/sipnet-${{ github.ref_name }}-${{ matrix.artifact_os }} + if-no-files-found: error + + release: + needs: build + runs-on: ubuntu-latest + steps: + - name: Download release artifacts + uses: actions/download-artifact@v4 + with: + path: dist + merge-multiple: true - # Create GitHub Release and Upload Asset - - name: Create Release and Upload Asset - id: create_release + - name: Create Release and Upload Assets uses: softprops/action-gh-release@v2 with: tag_name: ${{ github.ref_name }} - release_name: Release ${{ github.ref_name }} + name: Release ${{ github.ref_name }} body: | This release includes the latest SIPNET binary. draft: true # Create the release as a draft - files: ./sipnet # Path to the compiled binary + files: dist/* env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md index dde50fa9..db28d6b8 100644 --- a/docs/CHANGELOG.md +++ b/docs/CHANGELOG.md @@ -28,6 +28,7 @@ sections to include in release notes: ### Added +- Build and release binaries for MacOS and Windows on release (in addition to existing Linux builds) - Support for tillage events (#158) - `woodCreation` as output (#161) - Soil mineral pool (#170) diff --git a/docs/CONTRIBUTING.md b/docs/CONTRIBUTING.md index f29d0941..066e1af7 100644 --- a/docs/CONTRIBUTING.md +++ b/docs/CONTRIBUTING.md @@ -162,11 +162,21 @@ make -C tests/sipnet/test_events_infrastructure run ## Releases - Use [Semantic Versioning v2](https://semver.org/) for SIPNET releases. -- Tag the git commit associated with the release `vX.Y.Z`. - Update versions in: - `CITATION.cff` - `src/sipnet/version.h` - `docs/CHANGELOG.md` - `docs/Doxyfile` (`PROJECT_NUMBER`) - Run tests (`make test`). -- Publish the GitHub release; include `docs/CHANGELOG.md` content in release notes. +- Tag the git commit associated with the release `vX.Y.Z` and push tag to master. + ``` + git tag v + ``` +- Push tag to master branch, this will trigger a draft release + ``` + git push origin v0.0.0-test + ``` +- Open draft on https://github.com/pecanProject/sipnet/releases. +- Add content from `docs/CHANGELOG.md` to release notes. +- Publish the GitHub release; this will trigger archiving on Zenodo +- Get doi for this release from Zenodo and add to release notes. (note: README has a doi that represents all versions, and resolves to latest)