Merge pull request #107 from stocnet/develop #73
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
on: | |
push: | |
branches: | |
- main | |
name: Check and release | |
jobs: | |
build: | |
name: Build for ${{ matrix.config.os }} | |
runs-on: ${{ matrix.config.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
config: | |
- {os: macOS-latest, r: 'release', artifact_name: '*.tar.gz', asset_name: macOS} | |
- {os: windows-latest, r: 'release', artifact_name: '*.zip', asset_name: winOS} | |
- {os: ubuntu-20.04, r: 'release', rspm: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest", artifact_name: '*.tar.gz', asset_name: linuxOS} | |
env: | |
R_REMOTES_NO_ERRORS_FROM_WARNINGS: true | |
RSPM: ${{ matrix.config.rspm }} | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- uses: actions/checkout@v2 | |
- uses: r-lib/actions/setup-r@v2 | |
with: | |
r-version: ${{ matrix.config.r }} | |
- uses: r-lib/actions/setup-pandoc@v2 | |
- name: Install Mac dependencies | |
if: runner.os == 'macOS' | |
run: | | |
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)" | |
brew install autoconf | |
brew install automake | |
- uses: r-lib/actions/setup-r-dependencies@v2 | |
with: | |
cache-version: 2 | |
extra-packages: | | |
any::rcmdcheck | |
any::covr | |
any::remotes | |
needs: check | |
- uses: r-lib/actions/check-r-package@v2 | |
env: | |
_R_CHECK_FORCE_SUGGESTS_: false | |
with: | |
upload-snapshots: true | |
- name: Binary | |
run: | | |
pkgbuild::clean_dll() | |
binary <- pkgbuild::build(binary = TRUE, needs_compilation = TRUE, compile_attributes = TRUE) | |
dir.create("build") | |
file.copy(binary, "build") | |
shell: Rscript {0} | |
- name: Save binary artifact | |
uses: actions/upload-artifact@v1 | |
with: | |
name: ${{ matrix.config.asset_name }} | |
path: build/ | |
release: | |
name: Bump version and release | |
needs: build | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout one | |
uses: actions/checkout@master | |
with: | |
fetch-depth: '0' | |
- name: Bump version and push tag | |
id: newtag | |
uses: anothrNick/github-tag-action@1.39.0 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
WITH_V: true | |
DEFAULT_BUMP: patch | |
RELEASE_BRANCHES: main | |
- name: Checkout two | |
uses: actions/checkout@v2 | |
- name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ steps.newtag.outputs.tag }} | |
release_name: Release ${{ steps.newtag.outputs.tag }} | |
draft: false | |
prerelease: false | |
- name: Download binaries | |
uses: actions/download-artifact@v2 | |
- name: Display structure of downloaded files | |
run: ls -R | |
- name: Rename Mac release | |
run: mv ./macOS/*.tgz RSiena.tgz | |
- name: Upload Mac binary | |
id: upload-mac | |
uses: actions/upload-release-asset@v1.0.2 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps | |
asset_path: RSiena.tgz | |
asset_name: RSiena.tgz | |
asset_content_type: application/zip | |
- name: Rename Linux release | |
run: mv ./linuxOS/*.tar.gz RSiena.tar.gz | |
- name: Upload Linux binary | |
id: upload-lin | |
uses: actions/upload-release-asset@v1.0.2 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps | |
asset_path: RSiena.tar.gz | |
asset_name: RSiena.tar.gz | |
asset_content_type: application/zip | |
- name: Rename Windows release | |
run: mv ./winOS/*.zip RSiena.zip | |
- name: Upload Windows binary | |
id: upload-win | |
uses: actions/upload-release-asset@v1.0.2 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps | |
asset_path: RSiena.zip | |
asset_name: RSiena.zip | |
asset_content_type: application/zip |