Workflow file for this run
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
name: Build and Attach R Package | |
on: | |
release: | |
types: [created] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: r-lib/actions/setup-r@v2 | |
with: | |
r-version: release | |
http-user-agent: release | |
use-public-rspm: true | |
- name: Build package | |
run: | | |
R CMD build . | |
FILENAME=$(ls dso_*.tar.gz) | |
echo "FILENAME=${FILENAME}" >> $GITHUB_ENV | |
- name: Check version | |
run: | | |
VERSION=$(echo $FILENAME | sed 's/.*_\(.*\).tar.gz/\1/') | |
if [ "v${VERSION}" != "${GITHUB_REF#refs/tags/}" ]; then | |
echo "Version mismatch. Tag version and package version should be the same." | |
exit 1 | |
fi | |
- name: Attach tarball to release | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ github.event.release.upload_url }} | |
asset_path: ./${{ env.FILENAME }} | |
asset_name: ${{ env.FILENAME }} | |
asset_content_type: application/gzip |