Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add workflow to deploy updatesite for each master branch change #58

Merged
merged 1 commit into from
Jun 17, 2020

Conversation

ingomohr
Copy link
Contributor

For now the workflow does the following:

  • whenever the master branch changes
  • the updatesite is built
  • and on the "updatesite" branch (created if necessary) the "updatesite" folder's contents are being replaced w/ the new updatesite build.

I think we can use this for quick master branch dev integration builds.

@AObuchow Let me know what you think. Any feedback is appreciated :)

- name: Replace Updatesite
run: |
rm -r updatesite
git config --local user.email "tellastory73@gmail.com"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, damn - I think, we need another user for your repo ;) - sorry, my bad

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No worries :) I imagine the user would have to be my user? (or any committer on this repo?)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@PyvesB Even though I meanwhile suggested another approach - I would still like to understand how your solution works.
What I understood was:

  • You're using the jq tool to read info from a JSON - in this case from the payload
  • That way you read the user name of the pusher (of the event that triggered the job)
  • ... and the email (of the same)
  • ... and set both as git credentials

Am I right so far?

The thing is I just wasn't able to get it working.
I just received return code 1 on that step.
Since I didn't have a particular error message, I activated step-debugging on my repo.
But that didn't present me w/ an error message, either.

In your repository I didn't see some import of jq.
So... what do I have to do other than simply copy/pasting your two lines into my script?

Copy link
Contributor Author

@ingomohr ingomohr Jul 18, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah ok - now I understand your point. Yes, that's true - the "Github Action" as organization should not be "referenced". This was not intended, anyway.

So, @AObuchow what do you think? Do you want the workflow to be changed to have the actual user listed for the updatesite commit?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@PyvesB, @AObuchow github.actoris surely better than "Github Action", but it just resolves to the user name. Also, I don't know (yet) how to get to the mail address.

Screenshot 2020-07-19 at 11 27 48

We could hardcode the repo's owner's name and mail address, but that would also apply to all forks of the repo...

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would appending "@users.noreply.github.com" to the username work? Doesn't GitHub map that back to the user?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would appending "@users.noreply.github.com" to the username work? Doesn't GitHub map that back to the user?

Hm, good point. I'll try that. Thanks for the hint, @PyvesB.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works like a charm :) - I'll create a PR for this.

git add updatesite/
- name: Commit new Updatesite
run: |
git commit -m "deploy new updatesite"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A cool (but totally unnecessary) improvement for a future PR would be to read the pom.xml version and reference it in the commit message, like "deploy new updatesite for 1.0.8". Just thinking outloud :) It might be too annoying/hard for the value it gives.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yess! 🔥 Very good idea. I‘ll check that. 😊

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to discuss this further in its own issue. What do you think, @AObuchow?
This could make sense once we have a build script that adds new versions instead of simply replacing the latest version.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For sure :) Feel free to make an issue for it, if not I'll remember to make one

with:
branch: updatesite
force: true
github_token: ${{ secrets.GITHUB_TOKEN }}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I imagine I'll have to setup a github token/secret on the repo? :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I have no idea (yet) how that Github Push action determines the token. I have 4 tokens in my account, so if that action uses one of them, then: which one?
It was like that old Macintosh promise: „It just works“. 😂
I‘ll check today what token is referenced.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, so the quick take-away is that every repo on Github automatically has this token once you enable Github Actions on the repo. It has some limitations, but it certainly does the thing for our small build job.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome glad to hear :)

@AObuchow
Copy link
Owner

This is AWESOME @ingomohr !!! :D
Asides from the minor comments about the username & github token that need a bit of clarification, this seems great to me :)

I also tested out the updatesite and it works. I used:
https://raw.githubusercontent.com/ingomohr/Eclipse-Modern-Dark-Theme/updatesite/updatesite/

@AObuchow
Copy link
Owner

@PyvesB feel free to check this out by the way as we had previously discussed the topic :)

@ingomohr ingomohr force-pushed the master branch 4 times, most recently from dfe3809 to 1f15a7d Compare June 17, 2020 20:49
- name: Replace Updatesite
run: |
rm -r updatesite
git config --local user.name "GitHub Action"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While trying the find a solution why my jq-approach wasn't working, I found a couple of Github actions that by default specify "Github Action" with a no-reply email address for the commits.

For instance: https://github.com/marketplace/actions/configure-git-credentials

I think this is actually a good idea because you can see very easily that the commit is considered to be created by a Github action, not a human being user.

What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Screenshot 2020-06-17 at 22 57 55

This is what it looks like.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I’m +1 for that for sure (if it’s easy enough to do) :)

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks awesome :D

@AObuchow
Copy link
Owner

Hey @ingomohr this looks like it’s just about ready for a merge. Would you mind giving me some tips/instructions on what I need to do on my end as the repo owner? Either as a comment here or on twitter DM

@ingomohr
Copy link
Contributor Author

Hey @ingomohr this looks like it’s just about ready for a merge. Would you mind giving me some tips/instructions on what I need to do on my end as the repo owner? Either as a comment here or on twitter DM

From my point of view the only thing to do after the merge of this PR is to activate Github Actions on your repo's Settings -> Actions -> Enable local and third party Actions for this repository.

@AObuchow
Copy link
Owner

Looks good to me @ingomohr :D Amazing work, this will help get new versions deployed much sooner and more easily. Thank you @PyvesB for your input & review :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants