Skip to content

Commit e857db7

Browse files
committed
fix: github actions cache to v4
1 parent 1144037 commit e857db7

File tree

1 file changed

+92
-101
lines changed

1 file changed

+92
-101
lines changed

.github/workflows/ci-cd.yaml

Lines changed: 92 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -1,117 +1,108 @@
11
name: CI-CD
22

33
on:
4-
push:
5-
branches:
6-
- "master"
7-
- "releases/**"
8-
tags:
9-
- v[0-9]+.[0-9]+.[0-9]+
10-
pull_request: ~
11-
4+
push:
5+
branches:
6+
- "master"
7+
- "releases/**"
8+
tags:
9+
- v[0-9]+.[0-9]+.[0-9]+
10+
pull_request: ~
1211

1312
env:
14-
DOCKER_BUILDKIT: 1
13+
DOCKER_BUILDKIT: 1
1514

1615
jobs:
17-
quality:
18-
name: Quality
19-
runs-on: ubuntu-latest
16+
quality:
17+
name: Quality
18+
runs-on: ubuntu-latest
2019

21-
strategy:
22-
matrix:
23-
php: [ '8.2' ]
20+
strategy:
21+
matrix:
22+
php: ["8.2"]
2423

25-
steps:
26-
- name: Checkout
27-
uses: actions/checkout@v2
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v2
2827

29-
- name: Setup PHP
30-
uses: shivammathur/setup-php@v2
31-
with:
32-
coverage: "none"
33-
extensions: "json,openssl,mbstring,xml,ctype,iconv,intl"
34-
ini-values: "memory_limit=-1"
35-
php-version: "${{ matrix.php }}"
36-
tools: composer:v2, flex
28+
- name: Setup PHP
29+
uses: shivammathur/setup-php@v2
30+
with:
31+
coverage: "none"
32+
extensions: "json,openssl,mbstring,xml,ctype,iconv,intl"
33+
ini-values: "memory_limit=-1"
34+
php-version: "${{ matrix.php }}"
35+
tools: composer:v2, flex
3736

38-
- name: Determine composer cache directory
39-
id: composer-cache
40-
run: echo "::set-output name=directory::$(composer config cache-dir)"
37+
- name: Determine composer cache directory
38+
id: composer-cache
39+
run: echo "::set-output name=directory::$(composer config cache-dir)"
4140

42-
- name: Cache composer dependencies
43-
uses: actions/cache@v2
44-
with:
45-
path: ${{ steps.composer-cache.outputs.directory }}
46-
key: ${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }}
47-
restore-keys: ${{ matrix.php }}-composer-
41+
- name: Cache composer dependencies
42+
uses: actions/cache@v4
43+
with:
44+
path: ${{ steps.composer-cache.outputs.directory }}
45+
key: ${{ matrix.php }}-composer-${{ hashFiles('**/composer.lock') }}
46+
restore-keys: ${{ matrix.php }}-composer-
4847

49-
- name: Install Composer dependencies
50-
run: |
51-
composer install --no-progress --no-suggest --prefer-dist --optimize-autoloader --ansi
48+
- name: Install Composer dependencies
49+
run: |
50+
composer install --no-progress --no-suggest --prefer-dist --optimize-autoloader --ansi
5251
53-
- name: Quality
54-
run: |
55-
vendor/bin/psalm
56-
vendor/bin/phpcs
57-
images:
58-
runs-on: ubuntu-latest
59-
needs: quality
60-
if: github.event_name == 'push' && github.repository == 'aulasoftwarelibre/lock' && (startsWith(github.ref, 'refs/heads/releases/') || startsWith(github.ref, 'refs/tags/v') )
61-
steps:
62-
-
63-
name: Checkout
64-
uses: actions/checkout@v3
65-
-
66-
name: Set up QEMU
67-
uses: docker/setup-qemu-action@v1
68-
-
69-
name: Set up Docker Buildx
70-
uses: docker/setup-buildx-action@v1
71-
-
72-
name: Cache Docker layers
73-
uses: actions/cache@v2
74-
with:
75-
path: /tmp/.buildx-cache
76-
key: ${{ runner.os }}-buildx-${{ github.sha }}
77-
restore-keys: |
78-
${{ runner.os }}-buildx-
79-
-
80-
name: Login to GitHub Container Registry
81-
uses: docker/login-action@v1
82-
with:
83-
registry: ghcr.io
84-
username: ${{ secrets.CR_USER }}
85-
password: ${{ secrets.CR_PAT }}
52+
- name: Quality
53+
run: |
54+
vendor/bin/psalm
55+
vendor/bin/phpcs
56+
images:
57+
runs-on: ubuntu-latest
58+
needs: quality
59+
if: github.event_name == 'push' && github.repository == 'aulasoftwarelibre/lock' && (startsWith(github.ref, 'refs/heads/releases/') || startsWith(github.ref, 'refs/tags/v') )
60+
steps:
61+
- name: Checkout
62+
uses: actions/checkout@v3
63+
- name: Set up QEMU
64+
uses: docker/setup-qemu-action@v1
65+
- name: Set up Docker Buildx
66+
uses: docker/setup-buildx-action@v1
67+
- name: Cache Docker layers
68+
uses: actions/cache@v2
69+
with:
70+
path: /tmp/.buildx-cache
71+
key: ${{ runner.os }}-buildx-${{ github.sha }}
72+
restore-keys: |
73+
${{ runner.os }}-buildx-
74+
- name: Login to GitHub Container Registry
75+
uses: docker/login-action@v1
76+
with:
77+
registry: ghcr.io
78+
username: ${{ secrets.CR_USER }}
79+
password: ${{ secrets.CR_PAT }}
8680

87-
-
88-
name: Extract tag name
89-
id: extract_tag
90-
run: echo "::set-output name=tag::$(echo ${GITHUB_REF##*/})"
81+
- name: Extract tag name
82+
id: extract_tag
83+
run: echo "::set-output name=tag::$(echo ${GITHUB_REF##*/})"
9184

92-
-
93-
name: Build and push php
94-
uses: docker/build-push-action@v2
95-
with:
96-
context: .
97-
file: ./Dockerfile
98-
push: true
99-
target: lock_php
100-
tags: |
101-
ghcr.io/aulasoftwarelibre/lock-php:latest
102-
ghcr.io/aulasoftwarelibre/lock-php:${{ steps.extract_tag.outputs.tag }}
103-
cache-from: type=local,src=/tmp/.buildx-cache
104-
cache-to: type=local,dest=/tmp/.buildx-cache,mode=max
105-
-
106-
name: Build and push httpd
107-
uses: docker/build-push-action@v2
108-
with:
109-
context: .
110-
file: ./Dockerfile
111-
push: true
112-
target: lock_httpd
113-
tags: |
114-
ghcr.io/aulasoftwarelibre/lock-httpd:latest
115-
ghcr.io/aulasoftwarelibre/lock-httpd:${{ steps.extract_tag.outputs.tag }}
116-
cache-from: type=local,src=/tmp/.buildx-cache
117-
cache-to: type=local,dest=/tmp/.buildx-cache,mode=max
85+
- name: Build and push php
86+
uses: docker/build-push-action@v2
87+
with:
88+
context: .
89+
file: ./Dockerfile
90+
push: true
91+
target: lock_php
92+
tags: |
93+
ghcr.io/aulasoftwarelibre/lock-php:latest
94+
ghcr.io/aulasoftwarelibre/lock-php:${{ steps.extract_tag.outputs.tag }}
95+
cache-from: type=local,src=/tmp/.buildx-cache
96+
cache-to: type=local,dest=/tmp/.buildx-cache,mode=max
97+
- name: Build and push httpd
98+
uses: docker/build-push-action@v2
99+
with:
100+
context: .
101+
file: ./Dockerfile
102+
push: true
103+
target: lock_httpd
104+
tags: |
105+
ghcr.io/aulasoftwarelibre/lock-httpd:latest
106+
ghcr.io/aulasoftwarelibre/lock-httpd:${{ steps.extract_tag.outputs.tag }}
107+
cache-from: type=local,src=/tmp/.buildx-cache
108+
cache-to: type=local,dest=/tmp/.buildx-cache,mode=max

0 commit comments

Comments
 (0)