burnex icon indicating copy to clipboard operation
burnex copied to clipboard

Automatically update emails list

Open dolfinus opened this issue 3 years ago • 7 comments

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 avatar Mar 25 '21 21:03 dolfinus

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 avatar Mar 28 '21 14:03 dolfinus

@Betree Could you please take a look?

dolfinus avatar Apr 03 '21 17:04 dolfinus

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?

peaceful-james avatar Sep 12 '21 12:09 peaceful-james

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.

dolfinus avatar Sep 12 '21 20:09 dolfinus

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.

peaceful-james avatar Sep 13 '21 07:09 peaceful-james

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 avatar Oct 31 '21 12:10 dolfinus

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

peaceful-james avatar Nov 14 '21 00:11 peaceful-james