Skip to content

Commit

Permalink
extract tag
Browse files Browse the repository at this point in the history
  • Loading branch information
tinaxfwu authored and tinaxfwu committed Mar 2, 2025
1 parent 962f3d9 commit 8976353
Showing 1 changed file with 24 additions and 16 deletions.
40 changes: 24 additions & 16 deletions .github/workflows/image-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@ jobs:
runs-on: ubuntu-22.04
steps:

- name: Error if not a tag
uses: actions/github-script@v7
if: ${{ ! startsWith(github.ref, 'refs/tags/') }}
with:
script: core.setFailed('This action can only be run on tags')

- name: Set up Go
uses: actions/setup-go@v3
with:
Expand All @@ -21,11 +27,9 @@ jobs:
with:
fetch-depth: 0

- name: Error if not a tag
uses: actions/github-script@v7
if: ${{ ! startsWith(github.ref, 'refs/tags/') }}
with:
script: core.setFailed('This action can only be run on tags')
- name: Extract tag
id: tag
run: echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT

- name: Install kubebuilder
run: |
Expand Down Expand Up @@ -67,8 +71,8 @@ jobs:
run: |
docker image tag kuberay/apiserver:${{ steps.vars.outputs.sha_short }} quay.io/kuberay/apiserver:${{ steps.vars.outputs.sha_short }};
docker push quay.io/kuberay/apiserver:${{ steps.vars.outputs.sha_short }};
docker image tag kuberay/apiserver:${{ steps.vars.outputs.sha_short }} quay.io/kuberay/apiserver:${{ github.ref_name }};
docker push quay.io/kuberay/apiserver:${{ github.ref_name }}
docker image tag kuberay/apiserver:${{ steps.vars.outputs.sha_short }} quay.io/kuberay/apiserver:${{ steps.tag.outputs.tag }};
docker push quay.io/kuberay/apiserver:${{ steps.tag.outputs.tag }}
release_operator_image:
env:
Expand All @@ -77,6 +81,12 @@ jobs:
runs-on: ubuntu-22.04
steps:

- name: Error if not a tag
uses: actions/github-script@v7
if: ${{ ! startsWith(github.ref, 'refs/tags/') }}
with:
script: core.setFailed('This action can only be run on tags')

- name: Set up Go
uses: actions/setup-go@v3
with:
Expand All @@ -87,11 +97,9 @@ jobs:
with:
fetch-depth: 0

- name: Error if not a tag
uses: actions/github-script@v7
if: ${{ ! startsWith(github.ref, 'refs/tags/') }}
with:
script: core.setFailed('This action can only be run on tags')
- name: Extract tag
id: tag
run: echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT

- name: Install kubebuilder
run: |
Expand Down Expand Up @@ -165,7 +173,7 @@ jobs:
provenance: false
tags: |
quay.io/${{env.REPO_ORG}}/${{env.REPO_NAME}}:${{ steps.vars.outputs.sha_short }}
quay.io/${{env.REPO_ORG}}/${{env.REPO_NAME}}:${{ github.ref_name }}
quay.io/${{env.REPO_ORG}}/${{env.REPO_NAME}}:${{ steps.tag.outputs.tag }}
- name: Create tag
uses: actions/github-script@v6
Expand All @@ -174,6 +182,6 @@ jobs:
await github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: 'refs/tags/ray-operator/${{ github.ref_name }}',
sha: context.sha,
})
ref: 'refs/tags/ray-operator/${{ steps.tag.outputs.tag }}',
sha: '${{ github.sha }}'
})

0 comments on commit 8976353

Please sign in to comment.