Skip to content

Commit 598fc64

Browse files
committed
Use branch name for the images.
1 parent 989decd commit 598fc64

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

.github/workflows/ci.yml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ name: CI
33
permissions:
44
contents: read
55
packages: write
6+
pull-requests: write
67

78
on:
89
push:
@@ -17,11 +18,16 @@ jobs:
1718
build:
1819
name: Build
1920
runs-on: ubuntu-latest
21+
outputs:
22+
branch-tag: ${{ steps.branch.outputs.name }}
2023
steps:
2124
- uses: actions/checkout@v4
2225
- name: Set image name (lowercase)
2326
id: image
2427
run: echo "name=$(echo ghcr.io/${{ github.repository }} | tr '[:upper:]' '[:lower:]')" >> "$GITHUB_OUTPUT"
28+
- name: Set branch name
29+
id: branch
30+
run: echo "name=$(echo ${{ github.ref }} | sed 's|refs/heads/||' | tr '/' '-')" >> "$GITHUB_OUTPUT"
2531
- name: Set up Docker Buildx
2632
uses: docker/setup-buildx-action@v3
2733
- name: Log in to GitHub Container Registry
@@ -36,7 +42,7 @@ jobs:
3642
context: .
3743
file: .github/Dockerfile
3844
push: true
39-
tags: ${{ steps.image.outputs.name }}:${{ github.sha }},${{ steps.image.outputs.name }}:latest
45+
tags: ${{ steps.image.outputs.name }}:${{ github.sha }},${{ steps.image.outputs.name }}:${{ steps.branch.outputs.name }},${{ steps.image.outputs.name }}:latest
4046
cache-from: type=gha
4147
cache-to: type=gha,mode=max
4248
- name: Clean up old images
@@ -184,6 +190,8 @@ jobs:
184190
image: ghcr.io/ornl/chathpc-app:${{ github.sha }}
185191
steps:
186192
- uses: actions/checkout@v4
193+
- name: Configure git safe directory
194+
run: git config --global --add safe.directory '*'
187195
- name: Convert SSH URLs to HTTPS
188196
run: ./scripts/pyproject_ssh_to_https.sh
189197
- name: Run tests
@@ -221,6 +229,8 @@ jobs:
221229
image: ghcr.io/ornl/chathpc-app:${{ github.sha }}
222230
steps:
223231
- uses: actions/checkout@v4
232+
- name: Configure git safe directory
233+
run: git config --global --add safe.directory '*'
224234
- name: Convert SSH URLs to HTTPS
225235
run: ./scripts/pyproject_ssh_to_https.sh
226236
- name: Run coverage

0 commit comments

Comments
 (0)