spin icon indicating copy to clipboard operation
spin copied to clipboard

WIP: feat(ci): create sdk and template tag in release action

Open FrankYang0529 opened this issue 3 years ago • 6 comments

resolve https://github.com/fermyon/spin/issues/599

FrankYang0529 avatar Aug 11 '22 16:08 FrankYang0529

I will check how to commit with GPG tomorrow.

ref: https://gist.github.com/swinton/03e84635b45c78353b1f71e41007fc7c

FrankYang0529 avatar Aug 11 '22 16:08 FrankYang0529

I will check how to commit with GPG tomorrow.

ref: https://gist.github.com/swinton/03e84635b45c78353b1f71e41007fc7c

Hi @vdice, I use another way to commit templates change and it can have gpg key of github-actions[bot] like the following.

Screen Shot 2022-08-17 at 8 42 30 PM

FrankYang0529 avatar Aug 17 '22 12:08 FrankYang0529

Sorry, I found that I can't use FILE_TO_COMMIT: templates/*. It will create a new file *, so I add WIP to the title.

FrankYang0529 avatar Aug 17 '22 13:08 FrankYang0529

If we want to sign templates change commit with GPG key, I think the easiest way is to give gpg_private_key in secrets. Other ways like using gh api will need to create a tree first to commit multiple files.

https://github.com/crazy-max/ghaction-import-gpg https://dev.to/bro3886/create-a-folder-and-push-multiple-files-under-a-single-commit-through-github-api-23kc

FrankYang0529 avatar Aug 17 '22 13:08 FrankYang0529

@itowlson can you take a look at this PR when convenient? I'd like to double-check that we're automating the sdk and template tags correctly (see also https://github.com/fermyon/spin/pull/685#discussion_r943806935)

vdice avatar Aug 17 '22 15:08 vdice

@FrankYang0529 Indeed, it does look cleaner to supply the gpg key rather than constructing the tree. Are you able to test the gpg key approach on your fork?

vdice avatar Aug 17 '22 15:08 vdice

@vdice I add "Import GPG key" step and it works fine. The following pictures are results on my fork repo.

Screen Shot 2022-08-18 at 9 40 34 PM Screen Shot 2022-08-18 at 9 40 43 PM

Could you help to setup GPG_PRIVATE_KEY and PASSPHRASE ? Also, I am unsure what is the email of @fermybot?

Ref: https://github.com/crazy-max/ghaction-import-gpg

FrankYang0529 avatar Aug 18 '22 13:08 FrankYang0529

The failed workflow checks will be fixed here https://github.com/fermyon/spin/pull/687#discussion_r949181230.

FrankYang0529 avatar Aug 18 '22 14:08 FrankYang0529

@FrankYang0529 Excellent! Yes, I'll help add the secrets once back next week. Perhaps by then we can get @itowlson's eyes on the SDK/template tagging bits to make sure all looks good. This automation is really helpful!

vdice avatar Aug 19 '22 14:08 vdice

@FrankYang0529 Thanks so much for addressing all of the requested changes.

I've created a branch from this PR and am testing on my fork. However, on the create-go-sdk-tag step from the release workflow, I'm seeing the following:

To https://github.com/vdice/spin
 ! [remote rejected] sdk/go/v0.4.1 -> sdk/go/v0.4.1 (refusing to allow a GitHub App to create or update workflow `.github/workflows/release.yml` without `workflows` permission)

The permissions for the GitHub Action for my fork are already set to read and write: Screen Shot 2022-08-23 at 4 01 33 PM

Did you encounter the same behavior? Is a separate GITHUB_TOKEN with more advanced permissions necessary?

vdice avatar Aug 23 '22 22:08 vdice

@vdice, I didn't change any setting about permission. Do you set any rule in Protected tags? Screen Shot 2022-08-24 at 10 48 39 PM Screen Shot 2022-08-24 at 10 49 04 PM Screen Shot 2022-08-24 at 10 51 26 PM

FrankYang0529 avatar Aug 24 '22 14:08 FrankYang0529

@FrankYang0529 Thanks for comparing settings -- ours are the same. My first attempt whereupon I hit the aforementioned error, I had created the tag on a branch other than main. This time, I merged the branch to main on my fork and then created the tag -- and it worked! https://github.com/vdice/spin/runs/8024077723?check_suite_focus=true

vdice avatar Aug 25 '22 20:08 vdice

Checking in with @itowlson to be sure the requested changes have been made.

vdice avatar Aug 29 '22 19:08 vdice