Skip to content

Commit

Permalink
chore: fix php workflow to copy and push source to the other repo (#55)
Browse files Browse the repository at this point in the history
* chore: fix php workflow to copy and push source to the other repo

* chore: add pom info for java

* chore: fix gradle
  • Loading branch information
markphelps authored Jan 11, 2024
1 parent a1c7553 commit b864ff1
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 15 deletions.
28 changes: 13 additions & 15 deletions build/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,28 +258,26 @@ func phpBuild(ctx context.Context, client *dagger.Client, hostDirectory *dagger.
WithExec([]string{"sh", "-c", `git config --global http.https://github.com/.extraheader "AUTHORIZATION: Basic ${GITHUB_TOKEN}"`})

repository := git.
WithExec([]string{"git", "clone", "https://github.com/flipt-io/flipt-server-sdks.git", "/src"}).
WithExec([]string{"git", "clone", "https://github.com/flipt-io/flipt-server-sdks.git", "--branch", "flipt-php-" + targetTag, "/src"}).
WithWorkdir("/src")

filtered := repository.
WithEnvVariable("FILTER_BRANCH_SQUELCH_WARNING", "1").
WithExec([]string{"git", "filter-branch", "-f", "--prune-empty",
"--subdirectory-filter", "flipt-php",
"--", tag})

if !push {
_, err := filtered.Sync(ctx)
_, err := repository.Sync(ctx)
return err
}

// push to target repo/tag
_, err := filtered.WithExec([]string{
"git",
"push",
"-f",
targetRepo,
fmt.Sprintf("%s:%s", tag, targetTag)}).
gitCmd := fmt.Sprintf("git push %s `git subtree split --prefix flipt-php`:refs/heads/main --force", targetRepo)
_, err := repository.WithExec([]string{"sh", "-c", gitCmd}).
Sync(ctx)
if err != nil {
return err
}

// tag the release
_, err = git.WithExec([]string{"git", "clone", targetRepo, "/dst"}).
WithWorkdir("/dst").
WithExec([]string{"git", "tag", targetTag}).
WithExec([]string{"git", "push", "origin", targetTag}).
Sync(ctx)
return err
}
21 changes: 21 additions & 0 deletions flipt-java/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,27 @@ publishing {
maven(MavenPublication) {
artifactId = 'flipt-java'
from components.java

pom {
name = 'Flipt Java SDK'
description = 'Flipt Java SDK'
url = 'https://github.com/flipt-io/flipt-server-sdks/tree/main/flipt-java'

licenses {
license {
name = 'MIT'
url = 'https://opensource.org/license/mit/'
}
}

developers {
developer {
id = 'flipt-io'
name = 'Flipt'
email = '[email protected]'
}
}
}
}
}
repositories {
Expand Down
3 changes: 3 additions & 0 deletions flipt-php/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@

This directory contains the PHP source code for the Flipt [server-side](https://www.flipt.io/docs/integration/server/rest) client.

> [!NOTE]
> If you are on the <https://github.com/flipt-io/flipt-php> repository, this is a mirror of the source code. Please file issues and pull requests against the [flipt-io/flipt-server-sdks](https://github.com/flipt-io/flipt-server-sdks) repository.
## Status

This SDK status is `beta`, and there may be breaking changes between versions without a major version update. Therefore, we recommend pinning your installation of this package wherever necessary.
Expand Down

0 comments on commit b864ff1

Please sign in to comment.