ci: new tag format on pr
This commit is contained in:
parent
f358dc48fd
commit
ddba4de53b
1 changed files with 17 additions and 12 deletions
|
@ -41,11 +41,25 @@ jobs:
|
||||||
Status: ${{ job.status }}
|
Status: ${{ job.status }}
|
||||||
Source: ${{ github.head_ref }}
|
Source: ${{ github.head_ref }}
|
||||||
|
|
||||||
|
|
||||||
build:
|
build:
|
||||||
needs: [gitleaks, hadolint] # shellcheck
|
needs: [gitleaks, hadolint] # shellcheck
|
||||||
steps:
|
steps:
|
||||||
- uses: https://github.com/actions/checkout@v4
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
- name: Extract repository name
|
||||||
|
id: name
|
||||||
|
run: |
|
||||||
|
echo REPO_NAME=$(echo ${GITHUB_REPOSITORY} | awk -F"/" '{print $2}') >> $GITHUB_OUTPUT
|
||||||
|
- name: Docker meta
|
||||||
|
id: meta
|
||||||
|
uses: docker/metadata-action@v5
|
||||||
|
with:
|
||||||
|
images: |
|
||||||
|
registry.mgrote.net/${{ steps.name.outputs.REPO_NAME }}
|
||||||
|
tags: |
|
||||||
|
type=raw,value=latest,enable={{is_default_branch}}
|
||||||
|
type=ref,event=branch
|
||||||
|
type=ref,event=pr
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@v3
|
uses: docker/setup-buildx-action@v3
|
||||||
# - name: Login to Docker Hub
|
# - name: Login to Docker Hub
|
||||||
|
@ -53,21 +67,13 @@ jobs:
|
||||||
# with:
|
# with:
|
||||||
# username: ${{ secrets.DOCKERHUB_USERNAME }}
|
# username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
# password: ${{ secrets.DOCKERHUB_TOKEN }}
|
# password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
- name: Extract repository name
|
|
||||||
id: meta
|
|
||||||
run: |
|
|
||||||
echo REPO_NAME=$(echo ${GITHUB_REPOSITORY} | awk -F"/" '{print $2}') >> $GITHUB_OUTPUT
|
|
||||||
- name: Extract branch name
|
|
||||||
shell: bash
|
|
||||||
run: echo "REPO_BRANCH=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT
|
|
||||||
id: extract_branch
|
|
||||||
- name: Build and push Docker image
|
- name: Build and push Docker image
|
||||||
uses: https://github.com/docker/build-push-action@v6
|
uses: https://github.com/docker/build-push-action@v6
|
||||||
with:
|
with:
|
||||||
context: .
|
context: .
|
||||||
file: ./Dockerfile
|
file: ./Dockerfile
|
||||||
push: true
|
push: true
|
||||||
tags: "registry.mgrote.net/${{ steps.meta.outputs.REPO_NAME }}:latest,registry.mgrote.net/${{ steps.meta.outputs.REPO_NAME }}:${{ steps.extract_branch.outputs.REPO_BRANCH }}"
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
- name: Send notification
|
- name: Send notification
|
||||||
uses: dawidd6/action-send-mail@v3
|
uses: dawidd6/action-send-mail@v3
|
||||||
if: failure()
|
if: failure()
|
||||||
|
@ -83,4 +89,3 @@ jobs:
|
||||||
Job: ${{ github.action }}
|
Job: ${{ github.action }}
|
||||||
Status: ${{ job.status }}
|
Status: ${{ job.status }}
|
||||||
Source: ${{ github.head_ref }}
|
Source: ${{ github.head_ref }}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue