margelo / react-native-graph

📈 Beautiful, high-performance Graphs and Charts for React Native built with Skia
https://margelo.io
MIT License
2.08k stars 118 forks source link

Automated Release #30

Open akinncar opened 2 years ago

akinncar commented 2 years ago

What about automated releases? Every commit to main branch can be a new version

Workflow:

name: release
on: push

jobs:
  release:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: actions/setup-node@v1
        with:
          node-version: 14.x

      - run: yarn install
      - run: yarn test
      - run: yarn prepare

      - name: Release
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
        run: npx semantic-release --branches main
mrousavy commented 2 years ago

I like that idea and wanted to try it in all my repos (VisionCamera, MMKV, Blurhash, ...) but never got the chance to do it, since I also had to think about a manual way to trigger it (because a release is a commit and that would be an infinite loop), how would you solve that problem?

Maybe we can also trigger a PR whenever a dependency changes (like RN Skia), run pod install, and on merge a new version gets released

akinncar commented 2 years ago

you don't need to do a release commit using semantic-release, you can use "version": "0.0.0", in your package.json, semantic-release will bump the lib version using github tags, and according to your last commit

Take a look into semantic-release README Commit message Release type
fix(pencil): stop graphite breaking when too much pressure applied Patch Fix Release
feat(pencil): add 'graphiteWidth' option Minor Feature Release
perf(pencil): remove graphiteWidth optionBREAKING CHANGE: The graphiteWidth option has been removed.The default graphite width of 10mm is always used for performance reasons. Major Breaking Release(Note that the BREAKING CHANGE: token must be in the footer of the commit)


You can also manually cancel every build after pushing to master, so if you have for example 10 commits that will cancel builds, the next commit will release a new version with these 11 last commits. I really recommend you to try to do a PoC with that because it's a good life safer
mrousavy commented 2 years ago

Oh, that's good to know! Do you know if this also works with 2FA enabled on npm? Is there a special token that can bypass 2FA, or do I have to disable it for that to work?

akinncar commented 2 years ago

You don't need to disable it! you can generate a specific token for automations image

mrousavy commented 2 years ago

Awesome! I'll check it out thanks Akinn!

chrispader commented 2 years ago

I can maybe work on that soon. Have been working on CI/CD and automation a lot lately, so i hope i'll get it right 😅