diff --git a/.github/workflows/R-CMD-check.yml b/.github/workflows/R-CMD-check.yml index 42dfd3e..227d5bd 100644 --- a/.github/workflows/R-CMD-check.yml +++ b/.github/workflows/R-CMD-check.yml @@ -3,11 +3,17 @@ name: R CMD Check & Build on: push: branches: [ main, master ] + tags: + - 'v*' pull_request: branches: [ main, master ] + workflow_dispatch: jobs: R-CMD-check: + outputs: + full_version: ${{ steps.dynamic_version.outputs.FULL_VERSION }} + pkg_file: ${{ steps.build.outputs.PKG_FILE }} runs-on: ubuntu-latest permissions: contents: read @@ -21,7 +27,7 @@ jobs: - name: Set up R uses: r-lib/actions/setup-r@v2 with: - r-version: '4.5.0' + r-version: 'release' - name: Read version from .ver file id: get_version @@ -33,7 +39,13 @@ jobs: - name: Construct dynamic version string id: dynamic_version - run: echo "FULL_VERSION=${{ steps.get_version.outputs.VERSION }}.${{ steps.get_sha.outputs.SHA }}" >> $GITHUB_OUTPUT + run: | + if [ "${GITHUB_REF_TYPE}" = "tag" ]; then + VERSION="${GITHUB_REF_NAME#v}" + else + VERSION="${{ steps.get_version.outputs.VERSION }}.${{ steps.get_sha.outputs.SHA }}" + fi + echo "FULL_VERSION=$VERSION" >> $GITHUB_OUTPUT - name: Update DESCRIPTION file with dynamic version run: | @@ -72,3 +84,26 @@ jobs: with: name: processcontrol-${{ steps.dynamic_version.outputs.FULL_VERSION }} path: ${{ steps.build.outputs.PKG_FILE }} + + release: + needs: R-CMD-check + if: startsWith(github.ref, 'refs/tags/') + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - name: Download package artifact + uses: actions/download-artifact@v4 + with: + name: processcontrol-${{ needs.R-CMD-check.outputs.full_version }} + path: dist + + - name: List packaged files + run: ls -R dist + + - name: Publish GitHub release + uses: softprops/action-gh-release@v1 + with: + tag_name: ${{ github.ref_name }} + name: processcontrol ${{ needs.R-CMD-check.outputs.full_version }} + files: dist/${{ needs.R-CMD-check.outputs.pkg_file }} diff --git a/DESCRIPTION b/DESCRIPTION index fa25dd5..0e4b5c7 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -9,7 +9,7 @@ Description: Generate time series chart for individual values with mean and +/- 3 standard deviation lines and the corresponding mR chart with the upper control limit. Also execute the 8 Shewhart stability run tests and display the violations. Depends: - R (>= 4.5.0) + R (>= 4.0.0) License: MIT + file LICENSE LazyData: TRUE Imports: