-
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
11 additions
and
17 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 |
---|---|---|
|
@@ -4,7 +4,7 @@ name: Deploy Apps 🚀 | |
on: | ||
push: | ||
branches: | ||
- main | ||
- 78_simplify_joinkeys@main # TODO: change this to `dev` in `deploy_dev.yaml` and `main` in `deploy_stable.yaml` | ||
workflow_dispatch: | ||
schedule: | ||
- cron: "12 3 * * *" | ||
|
@@ -16,7 +16,9 @@ concurrency: | |
env: | ||
SHINYAPPSIO_ACCOUNT: genentech | ||
APP_PREFIX: NEST | ||
APP_SUFFIX: dev # TODO: change this to `dev` in `deploy_dev.yaml` and `stable` in `deploy_stable.yaml` | ||
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} | ||
BRANCH: 78_simplify_joinkeys@main # TODO: change this to `dev` in `deploy_dev.yaml` and `main` in `deploy_stable.yaml` | ||
|
||
jobs: | ||
deploy: | ||
|
@@ -44,19 +46,10 @@ jobs: | |
"python", | ||
"safety", | ||
] | ||
channel: ["stable", "dev"] | ||
steps: | ||
- name: Checkout repo 🛎 | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set channel related constants | ||
run: | | ||
if [ "${{ matrix.channel }}" = "stable" ]; then | ||
echo "BRANCH_NAME=main" >> $GITHUB_ENV # TODO: Change the branch name to main | ||
else | ||
echo "BRANCH_NAME=dev" >> $GITHUB_ENV # TODO: Change the branch name to deval | ||
fi | ||
- name: Check if cypress test exists | ||
id: find-cypress | ||
run: | | ||
|
@@ -81,7 +74,7 @@ jobs: | |
- name: Restore renv from cache | ||
uses: actions/cache@v3 | ||
env: | ||
CACHE_KEY: renv-${{ runner.arch }}-${{ runner.os }}-${{ matrix.directory }}-${{ matrix.channel }} | ||
CACHE_KEY: renv-${{ runner.arch }}-${{ runner.os }}-${{ matrix.directory }}-${{ env.APP_SUFFIX }} | ||
with: | ||
path: ${{ matrix.directory }}/renv/library | ||
key: ${{ env.CACHE_KEY }}-${{ hashFiles(format('{0}/renv.lock', matrix.directory)) }} | ||
|
@@ -92,10 +85,9 @@ jobs: | |
run: | | ||
setwd("${{ matrix.directory }}") | ||
lockfile <- renv::lockfile_read() | ||
pkg_name_structure <- ifelse("${{ matrix.channel }}" == "stable", "%s/%s@*release", "%s/%s") | ||
for (package in lockfile$Packages) { | ||
if (package$Source == "GitHub") { | ||
renv::record(sprintf(pkg_name_structure, package$RemoteUsername, package$Package)) | ||
renv::record(paste0(package$RemoteUsername, "/", package$Package)) # TODO: This installs packages form main branch, make necessary change for release version. | ||
} | ||
} | ||
|
@@ -143,8 +135,8 @@ jobs: | |
) | ||
rsconnect::deployApp( | ||
appFiles = c("app.R"), | ||
appName = rsconnect::generateAppName("${{ env.APP_PREFIX }}_${{ matrix.directory }}_${{ matrix.channel }}"), | ||
appTitle = "${{ env.APP_PREFIX }}_${{ matrix.directory }}_${{ matrix.channel }}", | ||
appName = rsconnect::generateAppName("${{ env.APP_PREFIX }}_${{ matrix.directory }}_${{ env.APP_SUFFIX }}"), | ||
appTitle = "${{ env.APP_PREFIX }}_${{ matrix.directory }}_${{ env.APP_SUFFIX }}", | ||
account = "${{ env.SHINYAPPSIO_ACCOUNT }}", | ||
upload = TRUE, | ||
logLevel = "normal", | ||
|
@@ -153,17 +145,19 @@ jobs: | |
) | ||
- name: Commit updated renv.lock file | ||
continue-on-error: true | ||
run: | | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "GitHub Action" | ||
git config --global --add safe.directory /__w/teal.gallery/teal.gallery | ||
git fetch | ||
git stash | ||
git checkout ${{ env.BRANCH_NAME }} | ||
git stash apply | ||
git pull | ||
git stash apply | ||
git add ${{ matrix.directory }}/renv.lock | ||
git add ${{ matrix.directory }}/renv/activate.R | ||
if [ -n "$(git diff --staged)" ]; then | ||
git add ${{ matrix.directory }}/renv.lock | ||
git commit -m "[skip deploy] Update renv.lock file for ${{ matrix.directory }} app" | ||
git push origin ${{ env.BRANCH_NAME }} | ||
else | ||
|