Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the automatic deployments - main #106

Merged
merged 6 commits into from
Nov 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.