react-native-graph icon indicating copy to clipboard operation
react-native-graph copied to clipboard

Automated Release

Open akinncar opened this issue 3 years ago • 6 comments

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

akinncar avatar Jul 17 '22 19:07 akinncar

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

mrousavy avatar Jul 18 '22 07:07 mrousavy

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

akinncar avatar Jul 18 '22 11:07 akinncar

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?

mrousavy avatar Jul 18 '22 13:07 mrousavy

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

akinncar avatar Jul 18 '22 13:07 akinncar

Awesome! I'll check it out thanks Akinn!

mrousavy avatar Jul 18 '22 13:07 mrousavy

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 😅

chrispader avatar Sep 12 '22 16:09 chrispader