Skip to content

Commit

Permalink
Add GitHub action to create Quay tags for release (opendatahub-io#3548)
Browse files Browse the repository at this point in the history
* GitHub action initial commit

* Add configuration to allow specific users to create tags

* Adding more usernames to authorized-tag-creators
  • Loading branch information
manaswinidas authored Dec 6, 2024
1 parent 4b8c2bf commit 966c055
Show file tree
Hide file tree
Showing 2 changed files with 69 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .github/workflows/authorized-tag-creators.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
manaswinidas
andrewballantyne
lucferbux
alexcreasy
christianvogt
mturley
Gkrumbach07
dgutride
adnankhan666
60 changes: 60 additions & 0 deletions .github/workflows/create-tag-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Create new Quay tag from latest main-tag for ODH release
on:
workflow_dispatch:
inputs:
existingTag:
description: Source tag
required: true
type: string
releaseTag:
description: Destination tag
required: true
type: string

env:
QUAY_ODH_DASHBOARD_IMAGE_REPO: ${{ secrets.QUAY_ODH_DASHBOARD_IMAGE_REPO }}

jobs:
create-tag:
runs-on: ubuntu-latest
steps:
- name: Git checkout
uses: actions/checkout@v4
with:
fetch-depth: '0'
- name: Check authorized user
id: auth-check
run: |
AUTHORIZED_USERS_FILE=".github/workflows/authorized-tag-creators.txt"
if [[ ! -f "$AUTHORIZED_USERS_FILE" ]]; then
echo "Authorized users file not found!"
exit 1
fi
if ! grep -q "^${GITHUB_ACTOR}$" "$AUTHORIZED_USERS_FILE"; then
echo "User ${GITHUB_ACTOR} is not authorized to run this workflow."
exit 1
fi
- name: Install podman
shell: bash
run: |
sudo apt-get -y update
sudo apt-get -y install podman
- name: Pull Quay repository
shell: bash
run: |
podman pull ${QUAY_ODH_DASHBOARD_IMAGE_REPO}
- name: Create new release tag off of latest main-tag
shell: bash
run: |
podman tag odh-dashboard:${{ github.event.inputs.existingTag }} ${QUAY_ODH_DASHBOARD_IMAGE_REPO}:${{ github.event.inputs.releaseTag }}
- name: Login to quay.io
shell: bash
env:
QUAY_TOKEN: ${{ secrets.QUAY_ROBOT_TOKEN }}
QUAY_ROBOT_USERNAME: ${{ secrets.QUAY_ROBOT_USERNAME }}
run: |
podman login quay.io -u ${QUAY_ROBOT_USERNAME} -p ${QUAY_TOKEN}
- name: Push the latest release tag to Quay
shell: bash
run: |
podman push ${QUAY_ODH_DASHBOARD_IMAGE_REPO}:${{ github.event.inputs.releaseTag }}

0 comments on commit 966c055

Please sign in to comment.