Skip to content
This repository was archived by the owner on Mar 4, 2025. It is now read-only.

Commit e643176

Browse files
conf(ci): Improve job execution
1 parent b6ea317 commit e643176

File tree

2 files changed

+80
-38
lines changed

2 files changed

+80
-38
lines changed

.github/renovate.json

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
{
2+
"timezone": "Europe/Madrid",
3+
"packageRules": [
4+
{
5+
"matchManagers": ["npm"],
6+
"matchDepTypes": ["devDependencies"],
7+
"groupName": "npm (development)"
8+
},
9+
{
10+
"matchManagers": ["npm"],
11+
"matchDepTypes": ["dependencies"],
12+
"groupName": "npm (runtime)"
13+
},
14+
{
15+
"matchManagers": ["github-actions"],
16+
"separateMajorMinor": false,
17+
"groupName": "ci"
18+
},
19+
{
20+
"matchUpdateTypes": ["lockFileMaintenance"],
21+
"groupName": "lockfiles",
22+
"dependencyDashboardApproval": true
23+
}
24+
],
25+
"dependencyDashboard": true,
26+
"prConcurrentLimit": 0,
27+
"prHourlyLimit": 0,
28+
"osvVulnerabilityAlerts": true,
29+
"vulnerabilityAlerts": {
30+
"enabled": true,
31+
"groupName": "vulnerable",
32+
"labels": ["security", "dependencies"]
33+
},
34+
"ignoreDeps": ["npm", "node"],
35+
"enabledManagers": ["npm", "github-actions"],
36+
"labels": ["dependencies"],
37+
"rebaseWhen": "behind-base-branch",
38+
"rangeStrategy": "pin",
39+
"lockFileMaintenance": {
40+
"enabled": true,
41+
"groupName": "lockfiles",
42+
"schedule": ["every month"]
43+
},
44+
"assignees": ["alvarobernal2412"],
45+
"reviewers": ["alvarobernal2412"],
46+
"extends": ["mergeConfidence:age-confidence-badges"]
47+
}

.github/workflows/docker-deploy.yml

Lines changed: 33 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -11,53 +11,48 @@ on:
1111
branches:
1212
- develop
1313
- main
14+
types:
15+
- labeled
16+
17+
env:
18+
REGISTRY_IMAGE: ${{ secrets.DOCKER_USERNAME }}/status-frontend
19+
PR_ID: ${{ github.event.pull_request.number }}
20+
TAG: ${{ github.ref_name }}
1421

1522
jobs:
1623
build:
1724
runs-on: ubuntu-latest
25+
if: (github.event.pull_request && github.event.label.name == 'dockerize') || github.event_name == 'push'
1826

1927
steps:
20-
- name: Checkout code
21-
uses: actions/checkout@v2
22-
23-
- name: Set up Docker Buildx
24-
uses: docker/setup-buildx-action@v2
28+
- name: Checkout ⬇️
29+
uses: actions/[email protected]
2530
with:
26-
install: true
31+
show-progress: false
32+
33+
- name: Configure QEMU ⚙️
34+
uses: docker/[email protected]
2735

28-
- name: Login to DockerHub
29-
uses: docker/login-action@v2
36+
- name: Configure Docker Buildx ⚙️
37+
uses: docker/[email protected]
38+
39+
- name: Login to DockerHub 🔑
40+
uses: docker/[email protected]
3041
with:
3142
username: ${{ secrets.DOCKER_USERNAME }}
3243
password: ${{ secrets.DOCKER_PASSWORD }}
3344

34-
- name: Create Docker Buildx Builder
35-
run: |
36-
docker buildx create --name mybuilder --use
37-
docker buildx inspect --bootstrap
38-
39-
- name: Build and Push Docker Image (Develop)
40-
if: github.ref == 'refs/heads/develop'
41-
run: |
42-
docker buildx build \
43-
--platform linux/amd64,linux/arm64 \
44-
--push \
45-
-t ${{ secrets.DOCKER_USERNAME }}/status-frontend:develop .
46-
47-
- name: Build and Push Docker Image (Version Tags)
48-
if: startsWith(github.ref, 'refs/tags/')
49-
run: |
50-
TAG=$(echo "${GITHUB_REF#refs/tags/}")
51-
docker buildx build \
52-
--platform linux/amd64,linux/arm64 \
53-
--push \
54-
-t ${{ secrets.DOCKER_USERNAME }}/status-frontend:$TAG .
55-
56-
- name: Build and Push Docker Image for Pull Request
57-
if: github.event_name == 'pull_request'
58-
run: |
59-
PR_ID=${{ github.event.pull_request.number }}
60-
docker buildx build \
61-
--platform linux/amd64,linux/arm64 \
62-
--push \
63-
-t ${{ secrets.DOCKER_USERNAME }}/status-frontend:PR.$PR_ID .
45+
- name: Build and Push Docker Image
46+
uses: docker/[email protected]
47+
with:
48+
context: .
49+
file: Dockerfile
50+
platforms: linux/amd64,linux/arm64
51+
push: true
52+
cache-from: type=gha
53+
cache-to: type=gha,mode=max
54+
tags: |
55+
${{ startsWith(github.ref, 'refs/tags/') && format('{0}:{1}', env.REGISTRY_IMAGE, env.TAG) || '' }}
56+
${{ github.ref == 'refs/heads/main' && format('{0}:latest', env.REGISTRY_IMAGE) || '' }}
57+
${{ github.ref == 'refs/heads/develop' && format('{0}:develop', env.REGISTRY_IMAGE) || '' }}
58+
${{ github.event_name == 'pull_request' && format('{0}:PR.{1}', env.REGISTRY_IMAGE, env.PR_ID) || '' }}

0 commit comments

Comments
 (0)