-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add github action for release builds
- Loading branch information
Showing
1 changed file
with
70 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
|