diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 425f92c..6f408a5 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -42,19 +42,21 @@ jobs: - name: Install golang run: | wget https://go.dev/dl/go${{ inputs.go-version }}.linux-amd64.tar.gz && tar xfz go${{ inputs.go-version }}.linux-amd64.tar.gz - - name: Bump version in spec file - run: | - export GOPATH=$(pwd)/go - export PATH=$PATH:$GOPATH/bin - cd reva-release - go run prepare_release.go -author "cernbox-admins[bot]" -email "cernbox-admins@cern.ch" - echo "version=$(awk '$1 == "Version:" {print $2}' cernbox-revad.spec)" >> $GITHUB_ENV - name: Checkout reva repository uses: actions/checkout@v3 with: repository: ${{ inputs.repo }}/reva path: reva ref: ${{ inputs.branch }} + - name: Bump version in spec file + run: | + export GOPATH=$(pwd)/go + export PATH=$PATH:$GOPATH/bin + cd reva + export REVAVER="$(git describe --always) commit $(git rev-parse --short HEAD) at ${{ inputs.branch }}/${{ inputs.repo }}" + cd ../reva-release + go run prepare_release.go -author "cernbox-admins[bot]" -email "cernbox-admins@cern.ch" -reva-version "$REVAVER" + echo "version=$(awk '$1 == "Version:" {print $2}' cernbox-revad.spec)" >> $GITHUB_ENV - name: Copy necessary files for building the RPMs run: | cp reva-release/Makefile reva/Makefile.rpm diff --git a/prepare_release.go b/prepare_release.go index 8085383..c44fa91 100644 --- a/prepare_release.go +++ b/prepare_release.go @@ -33,10 +33,11 @@ import ( ) var ( - author = flag.String("author", "", "the author that creates the release") - email = flag.String("email", "", "the email of the authot that creates the release") - versionTag = flag.String("version-tag", "", "the tag of the version") - version = flag.String("version", "0", "version to tag") + author = flag.String("author", "", "the author that creates the release") + email = flag.String("email", "", "the email of the authot that creates the release") + versionTag = flag.String("version-tag", "", "the tag of the version") + version = flag.String("version", "0", "version to tag") + revaVersion = flag.String("reva-version", "", "the reva version and commt") ) const ( @@ -47,21 +48,21 @@ const ( func init() { flag.Parse() - if *author == "" || *email == "" { - fmt.Fprintln(os.Stderr, "fill the author and email flags") + if *author == "" || *email == "" || *revaVersion == "" { + fmt.Fprintln(os.Stderr, "fill the author, email, and revaVersion flags") os.Exit(1) } } func main() { - err := releaseNewVersion(*author, *email) + err := releaseNewVersion(*author, *email, *revaVersion) if err != nil { fmt.Println(err) os.Exit(1) } } -func releaseNewVersion(author, email string) error { +func releaseNewVersion(author, email, revaVersion string) error { specContent, err := readSpecFile() if err != nil { return fmt.Errorf("error reading spec content: %w", err) @@ -94,7 +95,7 @@ func releaseNewVersion(author, email string) error { var newChangelog []string today := time.Now().Format("Mon Jan 02 2006") newChangelog = append(newChangelog, fmt.Sprintf("* %s %s <%s> %s", today, author, email, versionStr)) - newChangelog = append(newChangelog, fmt.Sprintf("- v%s", versionStr)) + newChangelog = append(newChangelog, fmt.Sprintf("- v%s, based on reva %s", versionStr, revaVersion)) var newSpec []string newSpec = append(newSpec, specContent[:changelogHeader+1]...)