Skip to content

Commit

Permalink
update gsub commands for updating version and date
Browse files Browse the repository at this point in the history
  • Loading branch information
e-perl-NOAA committed Oct 26, 2023
1 parent 442e091 commit 19cce8b
Showing 1 changed file with 22 additions and 10 deletions.
32 changes: 22 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,22 +50,34 @@ jobs:
run: |
version <- readLines("version.txt", encoding = "UTF-8")
manual_tex <- readLines("SS330_User_Manual.tex")
manual_tex[grep("Version", manual_tex)] <- gsub("[0-9].[0-9][0-9].[0-9][0-9]", version, manual_tex[grep("Version", manual_tex)])
date_line <- manual_tex[grep("date[{]", manual_tex)]
todays_month <- format(Sys.Date(), "%B")
todays_day <- format(Sys.Date(), "%d")
todays_year <- format(Sys.Date(), "%Y")
todays_date <- paste0("{", todays_month, " ", todays_day, ", ", todays_year, "}")
date_line <- gsub("\\{[^{}]*\\}", todays_date, date_line)
manual_tex[grep("date[{]", manual_tex)]<- date_line
writeLines(manual_tex, "SS330_User_Manual.tex")
manual_tex[grep("Version", manual_tex)] <- gsub(
pattern = "[0-9].[0-9][0-9].[0-9][0-9]",
replacement = version,
x = manual_tex[grep(pattern = "Version", x = manual_tex)]
)
date_line <- grep(pattern = "date\\{", x = manual_tex)
todays_date <- format(x = Sys.Date(), "%B %d, %Y")
manual_tex[date_line] <- gsub(
pattern = "\\{[A-Za-z0-9, ]+",
replacement = paste0("{", todays_date),
x = manual_tex[date_line]
# manual_tex[grep("Version", manual_tex)] <- gsub("[0-9].[0-9][0-9].[0-9][0-9]", version, manual_tex[grep("Version", manual_tex)])
# date_line <- manual_tex[grep("date[{]", manual_tex)]
# todays_month <- format(Sys.Date(), "%B")
# todays_day <- format(Sys.Date(), "%d")
# todays_year <- format(Sys.Date(), "%Y")
# todays_date <- paste0("{", todays_month, " ", todays_day, ", ", todays_year, "}")
# date_line <- gsub("\\{[^{}]*\\}", todays_date, date_line)
# manual_tex[grep("date[{]", manual_tex)]<- date_line
# writeLines(manual_tex, "SS330_User_Manual.tex")
shell: Rscript {0}

- name: Commit date and version changes in SS330_User_Manual.tex
uses: EndBug/add-and-commit@v9
with:
add: './docs/SS330_User_Manual.tex'
message: 'update version and date in manual'
message: 'release: update version and date in manual'

# HTML Portion
- name: Convert tex to html
Expand Down

0 comments on commit 19cce8b

Please sign in to comment.