Skip to content

Commit 0ea56bf

Browse files
authored
Simplify build and push of container. (#6)
1 parent f7a27dc commit 0ea56bf

File tree

1 file changed

+6
-15
lines changed

1 file changed

+6
-15
lines changed

.github/workflows/container.yaml

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ on:
44
push:
55
branches:
66
- main
7-
pull_request:
7+
workflow_dispatch:
88

99
jobs:
10-
build:
10+
docker-publish:
1111
runs-on: ubuntu-latest
1212

1313
steps:
@@ -17,26 +17,17 @@ jobs:
1717
- name: Set up Docker Buildx
1818
uses: docker/setup-buildx-action@v2
1919

20-
- name: Build Docker image
21-
run: |
22-
docker build -t ghcr.io/${{ github.repository }}:${{ github.sha }} .
23-
24-
push:
25-
runs-on: ubuntu-latest
26-
needs: build
27-
if: github.ref == 'refs/heads/main'
28-
29-
steps:
30-
- name: Checkout code
31-
uses: actions/checkout@v4
32-
3320
- name: Log in to GitHub Container Registry
3421
uses: docker/login-action@v2
3522
with:
3623
registry: ghcr.io
3724
username: ${{ github.actor }}
3825
password: ${{ secrets.GITHUB_TOKEN }}
3926

27+
- name: Build Docker image
28+
run: |
29+
docker build -t ghcr.io/${{ github.repository }}:${{ github.sha }} .
30+
4031
- name: Push Docker image
4132
run: |
4233
docker push ghcr.io/${{ github.repository }}:${{ github.sha }}

0 commit comments

Comments
 (0)