diff --git a/.github/workflows/write-manifest.yaml b/.github/workflows/write-manifest.yaml new file mode 100644 index 000000000..f9eef8bcc --- /dev/null +++ b/.github/workflows/write-manifest.yaml @@ -0,0 +1,43 @@ +# Workflow derived from https://solutions.posit.co/operations/deploy-methods/ci-cd/github-actions/#overview-of-deploying-to-connect + +name: write-manifest +on: + push: + branches: [dev] + pull_request: + branches: [dev] + +jobs: + write-manifest: + runs-on: ubuntu-latest + env: + GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} + steps: + - name: Checkout repo + uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - uses: r-lib/actions/setup-pandoc@v2 + + - uses: r-lib/actions/setup-r@v2 + with: + r-version: 'renv' + use-public-rspm: true + - uses: r-lib/actions/setup-renv@v2 + + - name: install required packages + run: Rscript -e 'install.packages(c("rsconnect"))' + + - name: Create manifest.json + shell: Rscript {0} + run: | + rsconnect::writeManifest() + + - name: commit results + run: | + git config --local user.name "$GITHUB_ACTOR" + git config --local user.email "$GITHUB_ACTOR@users.noreply.github.com" + git add manifest.json || echo "WARN: manifest.json was not updated" + git commit -m 'Re-build manifest file' || echo "No changes to commit" + git push origin || echo "No changes to commit"