Skip to content

Commit 9e91f56

Browse files
committed
i hate ci
1 parent e643f67 commit 9e91f56

File tree

1 file changed

+22
-32
lines changed

1 file changed

+22
-32
lines changed
Lines changed: 22 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,33 @@
1-
name: Build and Push Docker Image
1+
name: ci
22

33
on:
44
push:
5-
tags:
6-
- "*"
7-
workflow_dispatch:
85

96
jobs:
10-
build-and-push:
7+
docker:
118
runs-on: ubuntu-latest
12-
139
steps:
14-
# Checkout the repository
15-
- name: Checkout code
16-
uses: actions/checkout@v4
10+
- name: Login to GitHub Container Registry
11+
uses: docker/login-action@v3
12+
with:
13+
registry: ghcr.io
14+
username: ${{ github.repository_owner }}
15+
password: ${{ secrets.GITHUB_TOKEN }}
1716

18-
# Get the short commit hash
19-
- name: Get short commit hash
20-
id: vars
21-
run: echo "SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
17+
- id: image-path
18+
run: |
19+
echo "path=$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_OUTPUT
2220
23-
# Log in to GitHub Docker Registry
24-
- name: Log in to GitHub Docker Registry
25-
run: echo "$" | docker login ghcr.io -u $ --password-stdin
21+
- name: Set up QEMU
22+
uses: docker/setup-qemu-action@v3
2623

27-
# Build the Docker image
28-
- name: Build Docker image
29-
run: |
30-
REPO_OWNER=$(echo "$" | tr '[:upper:]' '[:lower:]')
31-
REPO_NAME=$(echo "$" | tr '[:upper:]' '[:lower:]')
32-
IMAGE_TAG=$([[ "$" == "push" && "$" =~ ^refs/tags/ ]] && echo "$" || echo "$")
33-
docker build . --file Dockerfile --tag ghcr.io/$REPO_OWNER/$REPO_NAME:${IMAGE_TAG}
34-
docker tag ghcr.io/$REPO_OWNER/$REPO_NAME:${IMAGE_TAG} ghcr.io/$REPO_OWNER/$REPO_NAME:latest
24+
- name: Set up Docker Buildx
25+
uses: docker/setup-buildx-action@v3
3526

36-
# Push the Docker image to GitHub Container Registry
37-
- name: Push Docker image
38-
run: |
39-
REPO_OWNER=$(echo "$" | tr '[:upper:]' '[:lower:]')
40-
REPO_NAME=$(echo "$" | tr '[:upper:]' '[:lower:]')
41-
IMAGE_TAG=$([[ "$" == "push" && "$" =~ ^refs/tags/ ]] && echo "$" || echo "$")
42-
docker push ghcr.io/$REPO_OWNER/$REPO_NAME:${IMAGE_TAG}
43-
docker push ghcr.io/$REPO_OWNER/$REPO_NAME:latest
27+
- name: Build and push
28+
uses: docker/build-push-action@v6
29+
with:
30+
platforms: linux/amd64,linux/arm64
31+
push: true
32+
tags: |
33+
ghcr.io/${{ steps.image-path.outputs.path }}:latest

0 commit comments

Comments
 (0)