From 12efaedd6c0d7c2692ce5bece18121f16e2f5fc4 Mon Sep 17 00:00:00 2001 From: Kyle Husmann Date: Wed, 9 Oct 2024 19:29:01 -0700 Subject: [PATCH] add github action for release builds --- .github/workflows/release-build.yaml | 70 ++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 .github/workflows/release-build.yaml diff --git a/.github/workflows/release-build.yaml b/.github/workflows/release-build.yaml new file mode 100644 index 0000000..1aa3ab3 --- /dev/null +++ b/.github/workflows/release-build.yaml @@ -0,0 +1,70 @@ +name: Build and Release R Package + +on: + release: + types: [created] + workflow_dispatch: # Add this for manual trigger + +jobs: + build: + name: Build R Package + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, macos-latest, windows-latest] + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Setup R environment + uses: r-lib/actions/setup-r@v2 + with: + r-version: "latest" + + - name: Install pak + run: Rscript -e 'install.packages("pak", repos = "https://r-lib.github.io/p/pak/dev/")' + + - name: Install dependencies + run: Rscript -e 'pak::pkg_install()' + + - name: Build package + run: R CMD build . + + - name: Create binary package + run: | + if [ "${{ matrix.os }}" == "windows-latest" ]; then + R CMD INSTALL --build . + else + R CMD INSTALL --build --binary . + fi + + # Temporary step for testing to upload the artifact + - name: Upload build artifact + uses: actions/upload-artifact@v3 + with: + name: interlacer-${{ matrix.os }} + path: "*.tar.gz" + + release: + if: github.event_name == 'release' # Only run this on real releases + name: Attach built packages to release + needs: build + runs-on: ubuntu-latest + + steps: + - name: Download built assets + uses: actions/download-artifact@v3 + with: + name: interlacer-${{ matrix.os }} + path: ./dist/ + + - name: Upload assets to GitHub Release + uses: actions/upload-release-asset@v1 + if: github.event_name == 'release' + with: + upload_url: ${{ github.event.release.upload_url }} + asset_path: ./dist/ + asset_name: "interlacer-${{ matrix.os }}.tar.gz" + asset_content_type: application/gzip +