-
Notifications
You must be signed in to change notification settings - Fork 38
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
Getting the github Repo from env #1532
Conversation
How to test this: We want to make sure this works for all forked branches
|
|
||
- name: Extract branch name | ||
id: extract_branch | ||
run: echo "BRANCH_NAME=$(basename ${{ github.ref }})" >> $GITHUB_ENV |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the step the pull the branch it is built from.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was an env variable called github.base_ref
but some reason it did not work. So I have to adopt this workaround for pulling the branch name
- name: build Docker image | ||
run: | | ||
docker build . --tag ghcr.io/${{ env.REPO_URL }}:${{ env.IMAGE_TAG }}-${BRANCH_NAME} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tag will like latest-master
or latest-2020-01.01
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting so it auto builds the tags too. That seems convenient. I think the name is fine with the latest in it.
jobs: | ||
build: | ||
# to test a feature, change the repo name to your github id | ||
if: github.repository_owner == 'tl-its-umich-edu' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This way we could stop the build for forked branches. I see an action recorded momentarily and it skips https://github.com/pushyamig/my-learning-analytics/actions/runs/6000238741. @jonespm Thanks for suggestion.
The better way if we want to skip it completely, than we need to create github PAT https://github.com/peter-evans/repository-dispatch. I think i will skip that far at the moment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is good for now.
@jonespm this is ready for review |
@jonespm This needs a review |
# takes muliple branch names | ||
branches: | ||
- master | ||
- '[0-9][0-9][0-9][0-9].[0-9][0-9].*' # 2021.01.01 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will support build of MyLA release branch if there is commit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Github Packages outcomes
The tagging is like latest-2023.09.x
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this looks good. We'll have to try it out to see how it works with the whole process but I don't have anything I'd change here yet.
Fixes #1533
The changes made check out the repo does and build and pushes to forked repo packages instead of TL Myla repo