Skip to content

Commit 7fb61c0

Browse files
committed
ci: workflow v2
1 parent 72b5622 commit 7fb61c0

1 file changed

Lines changed: 11 additions & 28 deletions

File tree

.github/workflows/build-push-docker.yml

Lines changed: 11 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,12 @@ permissions:
88
packages: read
99

1010
env:
11-
REGISTRY: ${{ vars.GITLAB_REGISTRY || 'registry.gitlab.inria.fr' }}
12-
PROJECT_PATH: ${{ vars.GITLAB_PROJECT_PATH || 'inocs-lab/inocs-sum-odp-frontend' }}
11+
IMAGE_NAME: inocs-sum-odp-webapp
12+
REGISTRY: ${{ secrets.GITLAB_REGISTRY }}
13+
PROJECT_PATH: ${{ vars.GITLAB_PROJECT_PATH }}
1314

1415
jobs:
15-
docker:
16-
name: Build and Push
16+
build:
1717
runs-on: ubuntu-latest
1818

1919
steps:
@@ -24,34 +24,17 @@ jobs:
2424
uses: docker/setup-buildx-action@v3
2525

2626
- name: Log in to GitLab Container Registry
27-
uses: docker/login-action@v3
28-
with:
29-
registry: ${{ env.REGISTRY }}
30-
username: gitlab-ci-token
31-
password: ${{ secrets.GITLAB_REGISTRY_TOKEN }}
27+
run: echo "${{ secrets.GITLAB_PASSWORD }}" | docker login ${{ env.REGISTRY }} -u ${{ secrets.GITLAB_USER }} --password-stdin
3228

33-
- name: Extract metadata (tags, labels)
34-
id: meta
35-
uses: docker/metadata-action@v5
36-
with:
37-
images: |
38-
${{ env.REGISTRY }}/${{ env.PROJECT_PATH }}
39-
tags: |
40-
type=ref,event=branch
41-
type=ref,event=tag
42-
type=sha,format=short
43-
type=raw,value=latest,enable={{is_default_branch}}
44-
45-
- name: Build and push
29+
- name: Build and push Docker image
4630
uses: docker/build-push-action@v6
4731
with:
4832
context: .
4933
file: ./Dockerfile
5034
push: true
51-
tags: ${{ steps.meta.outputs.tags }}
52-
labels: ${{ steps.meta.outputs.labels }}
35+
tags: |
36+
${{ env.REGISTRY }}/${{ env.PROJECT_PATH }}/${{ env.IMAGE_NAME }}:0.0.1
37+
${{ env.REGISTRY }}/${{ env.PROJECT_PATH }}/${{ env.IMAGE_NAME }}:${{ github.sha }}
5338
54-
- name: Show pushed tags
55-
run: |
56-
echo "Pushed:"
57-
echo "${{ steps.meta.outputs.tags }}" | tr ' ' '\n'
39+
- name: Logout
40+
run: docker logout ${{ env.REGISTRY }}

0 commit comments

Comments
 (0)