Skip to content

Automated release using GH Actions#60

Merged
bjlittle merged 5 commits intoSciTools:masterfrom
trexfeathers:automated-release
May 14, 2021
Merged

Automated release using GH Actions#60
bjlittle merged 5 commits intoSciTools:masterfrom
trexfeathers:automated-release

Conversation

@trexfeathers
Copy link
Contributor

@trexfeathers trexfeathers commented Mar 16, 2021

SciTools/iris#4024 means that Iris now expects to reference a specific release of iris-test-data. This effectively means any change to iris-test-data should involve a release.

So here is a proposal for a GitHub Action that creates a new release every time a push is made to master.


The below is no longer needed since d7a55e8.

### Help needed

For the Action to work, a RELEASE_TOKEN is needed. Someone with admin permissions for the repo will need to do this:

- Create an access token with public_repo scope:

- Create a new repo secret called RELEASE_TOKEN, set the value to that of the above access token.

@trexfeathers
Copy link
Contributor Author

This feels especially necessary given the upcoming serial addition (and likely downstream modifications) of several LFRic-UGRID files.

Copy link
Member

@jamesp jamesp left a comment

Choose a reason for hiding this comment

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

Super cool! A couple of questions inline

git pull
export CURRENT_VERSION=$(cat version.txt)
export THIS_VERSION=$(echo $CURRENT_VERSION | awk -F. -v OFS=. '{$NF++;print}')
echo "THIS_VERSION=$THIS_VERSION" >> $GITHUB_ENV
Copy link
Member

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.

Not that I'm aware of.
Is there an advantage to using the actions output syntax over the actions env syntax?

Copy link
Member

Choose a reason for hiding this comment

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

No idea! :) Either way looks like it works

env:
GITHUB_TOKEN: ${{ secrets.RELEASE_TOKEN }}
with:
args: v${{ env.THIS_VERSION }} v${{ env.THIS_VERSION }}
Copy link
Member

Choose a reason for hiding this comment

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

Why are args v repeated twice?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The first argument sets the release name, the second argument sets the tag value. It seems we're in a pattern of using the same value for both with our historic releases.

(If the second argument is missing, it gets filled with something else autogenerated).

@trexfeathers
Copy link
Contributor Author

@jamesp FYI I had a brief chat with @bjlittle earlier and we were unable to find a way to generate an access token that's associated with an organisation. Using a user-specific access token seems like a bad idea. So that's a barrier even if we're happy with the action itself.

@trexfeathers
Copy link
Contributor Author

Could we possibly generate a personal access token using the @SciTools-assistant ?

@jamesp
Copy link
Member

jamesp commented Mar 26, 2021

I'm not sure why it is different, but this action https://github.com/softprops/action-gh-release can use the GITHUB_TOKEN built into GH actions, so would not need an additional token?

@trexfeathers
Copy link
Contributor Author

I'm not sure why it is different, but this action https://github.com/softprops/action-gh-release can use the GITHUB_TOKEN built into GH actions, so would not need an additional token?

@jamesp elgohr/Github-Release-Action@1b08dc1

Perhaps it would be worth me trying this alternative Action you've referenced...

@jamesp
Copy link
Member

jamesp commented Mar 26, 2021

@jamesp elgohr/Github-Release-Action@1b08dc1

I wonder if this is because this action does things in a docker container? did you try it with GITHUB_TOKEN? It might be that the readme on that repo is out of date - looking here I don't see any reason why the token wouldn't work https://docs.github.com/en/actions/reference/authentication-in-a-workflow#permissions-for-the-github_token

@trexfeathers
Copy link
Contributor Author

did you try it with GITHUB_TOKEN?

@jamesp good shout - I just tried but it didn't work 👎

However it was an easy switch to use the softprops Action (d7a55e8), and that did work 👍. I also approve of their more helpful README, and their liberal use of emoji's - very GitHub!

So: this PR no longer needs any extra actions before merging.

Copy link
Member

@jamesp jamesp left a comment

Choose a reason for hiding this comment

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

Nice!
If @bjlittle is happy let's get this in. 1 small change/comment inline

Copy link
Member

@bjlittle bjlittle left a comment

Choose a reason for hiding this comment

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

@trexfeathers Awesome 🚀

LGTM. Lovely stuff! 😍

@bjlittle bjlittle merged commit f52a67d into SciTools:master May 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants