diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 0d94b3e..29a1d99 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -18,10 +18,19 @@ jobs: with: go-version: 1.17 - - name: Build + - name: Build Linux binary + run: GOOS=linux GOARCH=amd64 go build -o dum-flyway-validate main.go + + - name: Archive Linux artifacts + uses: actions/upload-artifact@v2 + with: + name: binaries + path: dum-flyway-validate + + - name: Build Windows binary run: GOOS=windows GOARCH=amd64 go build -o dum-flyway-validate.exe main.go - - name: Archive artifacts + - name: Archive Windows artifacts uses: actions/upload-artifact@v2 with: name: binaries @@ -56,7 +65,7 @@ jobs: tag_name: ${{ github.ref }} release_name: Release ${{ github.ref }} body: | - CLI tool to validate flyway migration for CI/CD + CLI tool to validate Flyway migration for CI/CD draft: true prerelease: false @@ -66,8 +75,19 @@ jobs: echo "Release HTML URL: ${{ steps.create_release.outputs.html_url }}" echo "Release Upload URL: ${{ steps.create_release.outputs.upload_url }}" - - name: Upload Release Asset - id: upload-release-asset + - name: Upload Linux Release Asset + id: upload-linux-release-asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: dum-flyway-validate + asset_name: dum-flyway-validate + asset_content_type: application/octet-stream + + - name: Upload Windows Release Asset + id: upload-windows-release-asset uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/README.md b/README.md index 635291e..f48d7ba 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@
-logo Dum Flyway Validate +logo Dum Flyway Validate # Dum Flyway Validate @@ -27,6 +27,12 @@ Dum Flyway Validate is a command-line tool to locally validate Flyway migrations ./dum-flyway-validate --migration-dir path/to/migrations --debug ``` +### Specify Branch for Comparison + +```bash +./dum-flyway-validate --migration-dir path/to/migrations --branch your-branch +``` + ## Conditions Checked - **Modified Migration File:** Error if modified after being applied. @@ -37,6 +43,35 @@ Dum Flyway Validate is a command-line tool to locally validate Flyway migrations - **Renamed Migration File:** Error if renamed after being applied. +## Additional Options + +- `--migration-dir`: Specifies the migration directory (default: current directory). +- `--branch`: Specifies the branch to compare against (default: empty, i.e., working directory). +- `--debug`: Enable debug mode. + + +## Continuous Integration Example + +Here is an example of integrating Dum Flyway Validate into your CI pipeline: + +```yaml +stages: + - validate + +variables: + DUM_FLYWAY_VALIDATE_VERSION: "v0.2.3" + MIGRATION_DIR: "path/to/migrations" + BRANCH_TO_COMPARE: "your-branch" + +validate: + stage: validate + script: + - wget https://github.com/Qypol342/dum-flyway-validate/releases/download/$DUM_FLYWAY_VALIDATE_VERSION/dum-flyway-validate + - chmod +x dum-flyway-validate + - ./dum-flyway-validate --migration-dir $MIGRATION_DIR --branch $BRANCH_TO_COMPARE +``` + + ## Contributing Contributions are welcome! Feel free to submit issues or pull requests. diff --git a/doc/assets/logo.png b/doc/assets/logo.png deleted file mode 100644 index 837af5b..0000000 Binary files a/doc/assets/logo.png and /dev/null differ diff --git a/doc/assets/logo.svg b/doc/assets/logo.svg new file mode 100644 index 0000000..85ac3c5 --- /dev/null +++ b/doc/assets/logo.svg @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/main.go b/main.go index b5ac7e0..dd91906 100644 --- a/main.go +++ b/main.go @@ -27,10 +27,7 @@ func init() { } func main() { - if flag.NArg() > 0 && (flag.Arg(0) == "--help" || flag.Arg(0) == "-h") { - printHelp() - os.Exit(0) - } + if debugMode { fmt.Println("Debug mode enabled") @@ -172,9 +169,3 @@ func isMatch(input, pattern string) bool { return re.MatchString(input) } -func printHelp() { - fmt.Println("Usage: dum-flyway-validate [OPTIONS]") - fmt.Println(" --migration-dir Specify the migration directory (default: current directory)") - fmt.Println(" --debug Enable debug mode") - fmt.Println(" --help, -h Show this help message") -}