forked from opendatahub-io/odh-dashboard
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Maia Iyer <maia.raj.iyer@gmail.com>
- Loading branch information
Showing
2 changed files
with
79 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
name: ghcr.push exporter | ||
# This GitHub action builds an image | ||
|
||
run-name: Push exporter image to ghcr | ||
on: | ||
push: | ||
branches: | ||
- '*' | ||
jobs: | ||
build-and-push-image: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- name: Git checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: '0' | ||
- name: Log in to GHCR.io | ||
uses: docker/login-action@v2.2.0 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Get image tag | ||
run: echo "GITHUB_SHA=$GITHUB_SHA" > .env.local | ||
- name: Set release repo | ||
run: echo "IMAGE_REPOSITORY=ghcr.io/${{ github.repository_owner }}/mcad-exporter:$GITHUB_SHA" >> .env.local | ||
- name: Set container builder | ||
run: echo "CONTAINER_BUILDER=docker" >> .env.local | ||
- name: Build image | ||
run: make build-exporter | ||
- name: Push image | ||
run: make push-exporter | ||
- name: Print job result | ||
run: | | ||
cat <<EOF >>"${GITHUB_STEP_SUMMARY}" | ||
- This job's stats is ${{ job.status }}. | ||
EOF | ||
tag-version-on-main: | ||
runs-on: ubuntu-latest | ||
needs: build-and-push-image | ||
if: github.ref == 'refs/heads/main' | ||
permissions: | ||
contents: read | ||
packages: write | ||
steps: | ||
- name: Git checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: '0' | ||
- name: Log in to GHCR.io | ||
uses: docker/login-action@v2.2.0 | ||
with: | ||
registry: ghcr.io | ||
username: ${{ github.repository_owner }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Get image tag | ||
run: echo "GITHUB_SHA=$GITHUB_SHA" >> $GITHUB_OUTPUT | ||
- name: Set origin image tag | ||
id: origin | ||
run: echo "IMAGE_REPOSITORY=ghcr.io/${{ github.repository_owner }}/mcad-exporter:$GITHUB_SHA" >> $GITHUB_OUTPUT | ||
- name: Set version image tag # TODO make version dynamic | ||
id: target | ||
run: echo "VERSION_TAG=ghcr.io/${{ github.repository_owner }}/mcad-exporter:v0.1.0" >> $GITHUB_OUTPUT | ||
- name: Tag and push image | ||
env: | ||
ORIGIN_REPO: ${{ steps.origin.outputs.IMAGE_REPOSITORY }} | ||
TARGET_REPO: ${{ steps.target.outputs.VERSION_TAG }} | ||
run: | | ||
docker pull ${{ env.ORIGIN_REPO }} | ||
docker tag ${{ env.ORIGIN_REPO }} ${{ env.TARGET_REPO }} | ||
docker push ${{ env.TARGET_REPO }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters