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

Deployer: open pr on launch #3953

Open
wants to merge 16 commits into
base: deployer
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 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
17 changes: 17 additions & 0 deletions deploy.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
DEPLOY_NOW = !get_env("DEPLOY_NOW").nil?
DEPLOY_CUSTOMIZE = !get_env("NO_DEPLOY_CUSTOMIZE")
DEPLOY_ONLY = !get_env("DEPLOY_ONLY").nil?
CREATE_AND_PUSH_BRANCH = !get_env("DEPLOY_CREATE_AND_PUSH_BRANCH").nil?
FLYIO_BRANCH_NAME = "flyio-new-files"

DEPLOY_APP_NAME = get_env("DEPLOY_APP_NAME")
if !DEPLOY_CUSTOMIZE && !DEPLOY_APP_NAME
Expand Down Expand Up @@ -61,6 +63,10 @@
artifact Artifact::META, { steps: steps }
end

if CREATE_AND_PUSH_BRANCH
steps.push({id: Step::CREATE_AND_PUSH_BRANCH, description: "Create Fly.io git branch with new files"})
end

if GIT_REPO_URL
in_step Step::GIT_PULL do
ref = get_env("GIT_REF")
Expand Down Expand Up @@ -383,4 +389,15 @@
end
end

if CREATE_AND_PUSH_BRANCH
in_step Step::CREATE_AND_PUSH_BRANCH do
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should do that after a successful deploy. Else, it probably means that the generated files are wrong.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good to me

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, you also only want to do that if GIT_REPO has been specified. This might sound annoying, but our tests won't always rely on the git repo being present.

exec_capture("git checkout -b #{FLYIO_BRANCH_NAME}")
exec_capture("git config user.name \"Fly.io\"")
exec_capture("git config user.email \"noreply@fly.io\"")
exec_capture("git add .")
exec_capture("git commit -m \"New files from Fly.io Launch\"")
exec_capture("git push origin #{FLYIO_BRANCH_NAME}")
end
end

event :end, { ts: ts() }
1 change: 1 addition & 0 deletions deploy/common.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ module Step
UPSTASH_REDIS = :upstash_redis
TIGRIS_OBJECT_STORAGE = :tigris_object_storage
SENTRY = :sentry
CREATE_AND_PUSH_BRANCH = :create_and_push_branch
DEPLOY = :deploy

def self.current
Expand Down
4 changes: 3 additions & 1 deletion scanner/scanner.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package scanner
import (
"embed"
"io/fs"
"os"
"path/filepath"
"strings"
"text/template"
Expand Down Expand Up @@ -141,7 +142,8 @@ func Scan(sourceDir string, config *ScannerConfig) (*SourceInfo, error) {
if err != nil {
return nil, err
}
if si != nil {
optOutGithubActions := os.Getenv("OPT_OUT_GITHUB_ACTIONS")
if si != nil && optOutGithubActions == "" {
github_actions(sourceDir, &si.GitHubActions)
return si, nil
}
Expand Down
Loading