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

Automatically update emails list #66

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

dolfinus
Copy link
Contributor

@dolfinus dolfinus commented Mar 25, 2021

Hello.

I found a beautiful solution of automatic updates of emails.txt file using Github Actions.
Here is the source: https://github.com/lindell/go-burner-email-providers/blob/main/.github/workflows/build.yaml

How it works:

  1. Github Actions is starting every day
  2. Emails.txt file is being downloaded from the source repo
  3. If nothing has been changed, the workflow is finished
  4. Otherwise the latest tag is being fetched, e.g. 3.1.0
  5. Patch part of the version number will be increased, e.g. 3.1.1
  6. Updated file will be commited to the master branch with a new tag
  7. New Github release will be created for this tag
  8. New version will then be uploaded into hex.pm

There are 2 things that should be done:

  1. Add up new repo secret PERSONAL_TOKEN. Here should be stored a Github Private token with scope repo. It will be used to push new commit with updated emails list, and also pushing new tags. Default GITHUB_TOKEN is not suitable here because it does not trigger workflows which is important for making automatic releases.
  2. Add up new repo secret HEX_API_KEY. Here should be stored the result of call mix hex.user key generate --permission api:write. It will be used to publish new package releases.

@dolfinus dolfinus changed the title Autometically update emails list Automatically update emails list Mar 25, 2021
Copy link
Owner

@Betree Betree left a comment

Choose a reason for hiding this comment

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

This is really nice @dolfinus! I'd prefer if we keep the release.yml job commented until we've seen sync.yml run a few times and are confident with it.

.github/workflows/sync.yml Outdated Show resolved Hide resolved
.github/workflows/sync.yml Outdated Show resolved Hide resolved
.github/workflows/sync.yml Outdated Show resolved Hide resolved
.github/workflows/sync.yml Outdated Show resolved Hide resolved
@dolfinus
Copy link
Contributor Author

I've changed the event in release.yml from push:tag to workflow_dispatch. It means that this step could only be started via REST API call, so you can test it manually.

@dolfinus dolfinus requested a review from Betree March 28, 2021 14:03
@dolfinus dolfinus closed this Apr 2, 2021
@dolfinus dolfinus reopened this Apr 3, 2021
@dolfinus
Copy link
Contributor Author

dolfinus commented Apr 3, 2021

@Betree Could you please take a look?

@peaceful-james
Copy link
Contributor

This is a really good idea and quite necessary for this lib (I think).

@dolfinus I see on your branch that the github actions have not run for a few months. https://github.com/wesbos/burner-email-providers was updated 25 days ago with a new list. I thought the github actions would update with this new list? Am I missing something? Do the actions only run every day on master?

@dolfinus
Copy link
Contributor Author

Hi.

github actions have not run for a few months

I've disabled this action just to stop it from adding new commits and making this PR full of unrelated changes.

I could create another branch with the same change to demonstrate the workflow if you wish.

@peaceful-james
Copy link
Contributor

Hi.

github actions have not run for a few months

I've disabled this action just to stop it from adding new commits and making this PR full of unrelated changes.

I could create another branch with the same change to demonstrate the workflow if you wish.

No need to create another branch. I understand. I hope this gets approved and merged.

@dolfinus
Copy link
Contributor Author

dolfinus commented Oct 31, 2021

I've added a workflow_dispatch rule to sync workflow, so now it can be run manually from Github Actions UI.

Example run of the sync job:
https://github.com/dolfinus/burnex/runs/4059966780?check_suite_focus=true

Example run of the triggered by commit tests job (it is failing because email.txt was updated a lot since last commit in the master branch) :
https://github.com/dolfinus/burnex/actions/runs/1404664889

This run generated a new tag 3.1.1:
https://github.com/dolfinus/burnex/releases/tag/3.1.1

@dolfinus dolfinus force-pushed the autoupdate_email_providers branch 5 times, most recently from 22cc550 to 1921973 Compare October 31, 2021 12:37
@peaceful-james
Copy link
Contributor

@Betree Can this be merged please? It would be a great addition.

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