Skip to content

Commit 6987802

Browse files
authored
Build and push in one job
1 parent 3ba157c commit 6987802

1 file changed

Lines changed: 25 additions & 41 deletions

File tree

.github/workflows/docker-image.yml

Lines changed: 25 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -9,53 +9,37 @@ on:
99
jobs:
1010

1111
build:
12-
name: Build image
12+
name: Build and push images
1313

1414
runs-on: ubuntu-latest
1515

16-
steps:
17-
- uses: actions/checkout@v3
18-
- name: Add GITHUB_SHA_SHORT env property with commit short sha
19-
run: echo "GITHUB_SHA_SHORT=`echo ${GITHUB_SHA} | cut -c1-8`" >> $GITHUB_ENV
20-
- name: Build the Docker image
21-
run: docker build . --file Dockerfile --tag openconceptlab/oclweb3:nightly --tag openconceptlab/oclweb3:3.0-alpha-${GITHUB_SHA_SHORT}
22-
23-
push_to_registries:
24-
name: Push images
25-
runs-on: ubuntu-latest
2616
permissions:
2717
packages: write
2818
contents: read
19+
2920
steps:
30-
- name: Check out the repo
31-
uses: actions/checkout@v4
32-
33-
- name: Log in to Docker Hub
34-
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
35-
with:
36-
username: ${{ secrets.DOCKER_USERNAME }}
37-
password: ${{ secrets.DOCKER_PASSWORD }}
38-
39-
- name: Log in to the Container registry
40-
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
41-
with:
42-
registry: ghcr.io
43-
username: ${{ github.actor }}
44-
password: ${{ secrets.GITHUB_TOKEN }}
45-
46-
- name: Extract metadata (tags, labels) for Docker
47-
id: meta
48-
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
49-
with:
50-
images: |
51-
my-docker-hub-namespace/my-docker-hub-repository
52-
ghcr.io/${{ github.repository }}
21+
- uses: actions/checkout@v3
22+
23+
- name: Add GITHUB_SHA_SHORT env property with commit short sha
24+
run: echo "GITHUB_SHA_SHORT=`echo ${GITHUB_SHA} | cut -c1-8`" >> $GITHUB_ENV
5325

54-
- name: Build and push Docker images
55-
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
56-
with:
57-
context: .
58-
push: true
59-
tags: ${{ steps.meta.outputs.tags }}
60-
labels: ${{ steps.meta.outputs.labels }}
26+
- name: Log in to Docker Hub
27+
uses: docker/login-action@f4ef78c080cd8ba55a85445d5b36e214a81df20a
28+
with:
29+
username: ${{ secrets.DOCKER_USERNAME }}
30+
password: ${{ secrets.DOCKER_PASSWORD }}
31+
32+
- name: Log in to the Container registry
33+
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
34+
with:
35+
registry: ghcr.io
36+
username: ${{ github.actor }}
37+
password: ${{ secrets.GITHUB_TOKEN }}
38+
39+
- name: Build and push Docker images
40+
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
41+
with:
42+
context: .
43+
push: true
44+
tags: openconceptlab/oclweb3:nightly, openconceptlab/oclweb3:3.0-alpha-${GITHUB_SHA_SHORT}
6145

0 commit comments

Comments
 (0)