ci: improve security by using GHA environments (#2335)

This commit is contained in:
Kévin Dunglas
2026-04-08 17:58:46 +02:00
committed by GitHub
parent 359eca3fc4
commit 6f559e14d5
4 changed files with 17 additions and 10 deletions
+6 -4
View File
@@ -80,6 +80,7 @@ jobs:
VERSION: ${{ (github.ref_type == 'tag' && github.ref_name) || steps.check.outputs.ref || 'dev' }}
PHP_VERSION: ${{ steps.check.outputs.php_version }}
build:
environment: dockerhub
runs-on: ${{ startsWith(matrix.platform, 'linux/arm') && 'ubuntu-24.04-arm' || 'ubuntu-24.04' }}
needs:
- prepare
@@ -129,8 +130,8 @@ jobs:
uses: docker/login-action@v4
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
with:
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build
id: build
uses: docker/bake-action@v7
@@ -204,6 +205,7 @@ jobs:
# Adapted from https://docs.docker.com/build/ci/github-actions/multi-platform/
push:
environment: dockerhub
runs-on: ubuntu-24.04
needs:
- prepare
@@ -227,8 +229,8 @@ jobs:
uses: docker/login-action@v4
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
with:
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Create manifest list and push
working-directory: /tmp/metadata
run: |
+1
View File
@@ -16,6 +16,7 @@ concurrency:
cancel-in-progress: true
jobs:
deploy:
environment: website
runs-on: ubuntu-slim
steps:
- name: Trigger website deployment
+9 -6
View File
@@ -84,6 +84,7 @@ jobs:
VERSION: ${{ steps.check.outputs.ref || 'dev' }}
build-linux-musl:
environment: dockerhub
permissions:
contents: write
id-token: write
@@ -121,8 +122,8 @@ jobs:
uses: docker/login-action@v4
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
with:
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Set VERSION
run: |
if [ "${GITHUB_REF_TYPE}" == "tag" ]; then
@@ -219,6 +220,7 @@ jobs:
BINARY: ./frankenphp-linux-${{ matrix.platform == 'linux/amd64' && 'x86_64' || 'aarch64' }}${{ matrix.debug && '-debug' || '' }}${{ matrix.mimalloc && '-mimalloc' || '' }}
build-linux-gnu:
environment: dockerhub
permissions:
contents: write
id-token: write
@@ -289,8 +291,8 @@ jobs:
uses: docker/login-action@v4
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
with:
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build
id: build
uses: docker/bake-action@v7
@@ -377,6 +379,7 @@ jobs:
# Adapted from https://docs.docker.com/build/ci/github-actions/multi-platform/
push:
environment: dockerhub
runs-on: ubuntu-24.04
needs:
- prepare
@@ -402,8 +405,8 @@ jobs:
uses: docker/login-action@v4
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository
with:
username: ${{ secrets.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_PASSWORD }}
username: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Create manifest list and push
working-directory: /tmp/metadata
run: |
+1
View File
@@ -13,6 +13,7 @@ permissions:
pull-requests: write
jobs:
build:
environment: translate
name: Translate Docs
runs-on: ubuntu-latest
steps: