lisawray / groupie

Groupie helps you display and manage complex RecyclerView layouts.
MIT License
3.67k stars 293 forks source link

Automate library releases #315

Open ValCanBuild opened 4 years ago

ValCanBuild commented 4 years ago

Currently there is a manual process related to releasing a Groupie version. I'd like to automate that using the CircleCI setup we already have in place.

Basically, I want any tagged commits to automatically create a new release.

I have the keystore file and it's details and I can add them as encrypted files + variables to whatever CircleCI setup is made.

If anyone has CircleCI experience I'll welcome PRs or guides to do this.

nashcft commented 4 years ago

I'm not sure about recently-added CircleCI features well, but if you can set secrets to the project on CircleCI, I think you can achieve release automation by adding a job running commands for release (+ setup configurations: keystore, properties, etc... if needed), and create workflow configurations like following:

workflows:
  version: 2
  build_test:
    jobs:
      - build:
          filters:
            tags:
              ignore: /.*/
  release:
    jobs:
      - release: # name of added job for release
          filters:
            tags:
              only: /^(0|[1-9]+?\d*)\.(0|[1-9]+?\d*)\.(0|[1-9]+?\d*)(-(alpha|beta|rc)([1-9]+?\d*))$/
            branches:
              ignore: /.*/

First build_test workflow is the same as current job running for each push and set a filter not to run when pushing tag. Second release workflow is for release. The filter above means the release job runs only when tag whose name represents version name like x.y.z (and alpha/beta/rc if you want) is pushed. the regex for tag-filter can be simpler if the tags for release have some identifiable prefix.

Details about filtering of Git tags are available at https://circleci.com/docs/2.0/workflows/#executing-workflows-for-a-git-tag

amitav13 commented 4 years ago

If we're willing to switch to github actions over CircleCI, I've done this in a different project. I push a tag, it triggers a release build.