Skip to content

Commit

Permalink
Getting the github Repo from env (#1532)
Browse files Browse the repository at this point in the history
  • Loading branch information
pushyamig authored Sep 13, 2023
1 parent 9018413 commit c156cf8
Showing 1 changed file with 27 additions and 6 deletions.
33 changes: 27 additions & 6 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,41 @@ name: Docker image CI

on:
push:
branches: ['master']
workflow_dispatch:
# takes muliple branch names
branches:
- master
- '[0-9][0-9][0-9][0-9].[0-9][0-9].*' # 2021.01.01

env:
IMAGE_TAG: latest
REPO_URL: ${{ github.repository }}

jobs:
build:
# to test a feature, change the repo name to your github id
if: github.repository_owner == 'tl-its-umich-edu'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Checkout code
uses: actions/checkout@v3

- name: Extract branch name
id: extract_branch
run: echo "BRANCH_NAME=$(basename ${{ github.ref }})" >> $GITHUB_ENV

- name: build Docker image
run: |
docker build . --tag ghcr.io/${{ env.REPO_URL }}:${{ env.IMAGE_TAG }}-${BRANCH_NAME}
- name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build Docker Image

- name: Push Docker image to GitHub Container Registry
run: |
docker build . --tag ghcr.io/tl-its-umich-edu/my-learning-analytics:latest
docker push ghcr.io/tl-its-umich-edu/my-learning-analytics:latest
docker push ghcr.io/${{ env.REPO_URL }}:${{ env.IMAGE_TAG }}-${BRANCH_NAME}

0 comments on commit c156cf8

Please sign in to comment.