fix: assigng correct tags to dev builds
This commit is contained in:
parent
ba41fb22cd
commit
36709df589
1 changed files with 81 additions and 0 deletions
81
.github/workflows/ci.yml
vendored
81
.github/workflows/ci.yml
vendored
|
|
@ -53,3 +53,84 @@ jobs:
|
|||
|
||||
- name: Run code checks
|
||||
run: docker compose exec -T phx mix check --no-fix --no-retry
|
||||
|
||||
docker-pr:
|
||||
name: Build PR Image
|
||||
runs-on: ubuntu-latest
|
||||
needs: test
|
||||
# Fork PRs can't write to GHCR, so skip them to avoid auth failures
|
||||
if: |
|
||||
github.event_name == 'pull_request' &&
|
||||
!startsWith(github.head_ref, 'release-please') &&
|
||||
github.event.pull_request.head.repo.full_name == github.repository
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Get short SHA
|
||||
id: sha
|
||||
run: echo "value=${GITHUB_SHA:0:7}" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
file: ./docker/selfhosted.Dockerfile
|
||||
platforms: linux/amd64
|
||||
push: true
|
||||
tags: ghcr.io/${{ github.repository }}:pr-${{ github.event.pull_request.number }}-${{ steps.sha.outputs.value }}
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
|
||||
docker-rc:
|
||||
name: Build RC Image
|
||||
runs-on: ubuntu-latest
|
||||
needs: test
|
||||
if: |
|
||||
github.event_name == 'pull_request' &&
|
||||
startsWith(github.head_ref, 'release-please') &&
|
||||
github.event.pull_request.head.repo.full_name == github.repository
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Get version from version.txt
|
||||
id: version
|
||||
run: echo "value=$(cat version.txt)" >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Login to GitHub Container Registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ghcr.io
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Build and push
|
||||
uses: docker/build-push-action@v6
|
||||
with:
|
||||
context: .
|
||||
file: ./docker/selfhosted.Dockerfile
|
||||
platforms: linux/amd64
|
||||
push: true
|
||||
tags: ghcr.io/${{ github.repository }}:rc-${{ steps.version.outputs.value }}-${{ github.run_number }}
|
||||
cache-from: type=gha
|
||||
cache-to: type=gha,mode=max
|
||||
|
|
|
|||
Loading…
Reference in a new issue