Skip to content

Commit

Permalink
Fix the automatic deployments - main (#106)
Browse files Browse the repository at this point in the history
1/2 part of #105
  • Loading branch information
vedhav authored Nov 23, 2023
1 parent 864e938 commit e047033
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 174 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
---
name: Deploy Stable Apps 🚀
name: Deploy Apps 🚀

on:
push:
branches:
- main
- dev
workflow_dispatch:
schedule:
- cron: "12 3 * * *"
Expand All @@ -16,12 +17,12 @@ concurrency:
env:
SHINYAPPSIO_ACCOUNT: genentech
APP_PREFIX: NEST
APP_SUFFIX: stable
GITHUB_PAT: ${{ secrets.REPO_GITHUB_TOKEN }}
BRANCH: main

jobs:
deploy:
permissions:
contents: write
defaults:
run:
shell: bash
Expand All @@ -46,9 +47,20 @@ jobs:
"python",
"safety",
]
channel: ["stable", "dev"]
steps:
- name: Set channel related constants
run: |
if [ "${{ matrix.channel }}" = "stable" ]; then
echo "BRANCH_NAME=main" >> $GITHUB_ENV
else
echo "BRANCH_NAME=dev" >> $GITHUB_ENV
fi
- name: Checkout repo 🛎
uses: actions/checkout@v3
with:
ref: "${{ env.BRANCH_NAME }}"

- name: Check if cypress test exists
id: find-cypress
Expand All @@ -74,7 +86,7 @@ jobs:
- name: Restore renv from cache
uses: actions/cache@v3
env:
CACHE_KEY: renv-${{ runner.arch }}-${{ runner.os }}-${{ matrix.directory }}-${{ env.APP_SUFFIX }}
CACHE_KEY: renv-${{ runner.arch }}-${{ runner.os }}-${{ matrix.directory }}-${{ matrix.channel }}
with:
path: ${{ matrix.directory }}/renv/library
key: ${{ env.CACHE_KEY }}-${{ hashFiles(format('{0}/renv.lock', matrix.directory)) }}
Expand All @@ -85,9 +97,10 @@ 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(paste0(package$RemoteUsername, "/", package$Package, "@*release"))
renv::record(sprintf(pkg_name_structure, package$RemoteUsername, package$Package))
}
}
Expand Down Expand Up @@ -135,8 +148,8 @@ jobs:
)
rsconnect::deployApp(
appFiles = c("app.R"),
appName = rsconnect::generateAppName("${{ env.APP_PREFIX }}_${{ matrix.directory }}_${{ env.APP_SUFFIX }}"),
appTitle = "${{ env.APP_PREFIX }}_${{ matrix.directory }}_${{ env.APP_SUFFIX }}",
appName = rsconnect::generateAppName("${{ env.APP_PREFIX }}_${{ matrix.directory }}_${{ matrix.channel }}"),
appTitle = "${{ env.APP_PREFIX }}_${{ matrix.directory }}_${{ matrix.channel }}",
account = "${{ env.SHINYAPPSIO_ACCOUNT }}",
upload = TRUE,
logLevel = "normal",
Expand All @@ -147,8 +160,8 @@ jobs:
- name: Commit updated renv.lock file
continue-on-error: true
run: |
git config --global user.email "action@github.com"
git config --global user.name "GitHub Action"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions"
git config --global --add safe.directory /__w/teal.gallery/teal.gallery
git fetch
git stash
Expand Down
165 changes: 0 additions & 165 deletions .github/workflows/deploy_dev.yaml

This file was deleted.

0 comments on commit e047033

Please sign in to comment.