Skip to content

Commit da65ebd

Browse files
committed
Protect secrets
1 parent 8613eb1 commit da65ebd

1 file changed

Lines changed: 9 additions & 22 deletions

File tree

.github/workflows/ci.yml

Lines changed: 9 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,37 +2,24 @@ name: CI
22

33
"on": push
44

5-
env:
6-
# renovate: datasource=github-releases depName=docker/buildx
7-
BUILDX_VERSION: v0.30.1
8-
95
jobs:
106
build:
117
runs-on: ubuntu-latest
12-
8+
environment: ${{ (github.ref == 'refs/heads/master' || github.ref_type == 'tag') && 'release' || null }}
139
steps:
14-
- name: Checkout
15-
uses: actions/checkout@v6
16-
17-
- name: Set up QEMU
18-
uses: docker/setup-qemu-action@v4
19-
20-
- name: Set up Docker Buildx
21-
uses: docker/setup-buildx-action@v4
22-
with:
23-
version: ${{ env.BUILDX_VERSION }}
24-
25-
- name: Login to Docker Hub
10+
- uses: actions/checkout@v6
11+
- uses: docker/setup-qemu-action@v4
12+
- uses: docker/setup-buildx-action@v4
13+
# Login only when the DOCKERHUB_USERNAME variable is provided via the job environment
14+
- if: vars.DOCKERHUB_USERNAME != null
2615
uses: docker/login-action@v4
2716
with:
28-
username: ${{ secrets.DOCKERHUB_USERNAME }}
17+
username: ${{ vars.DOCKERHUB_USERNAME }}
2918
password: ${{ secrets.DOCKERHUB_TOKEN }}
30-
31-
- name: Build
32-
uses: docker/bake-action@v7
19+
- uses: docker/bake-action@v7
3320
with:
3421
targets: all
35-
push: ${{ github.ref == 'refs/heads/master' || github.ref_type == 'tag' }}
22+
push: ${{ vars.DOCKERHUB_USERNAME != null }}
3623
env:
3724
PLATFORMS: linux/amd64,linux/arm64
3825
TAG: ${{ github.ref_type == 'tag' && github.ref_name || '' }}

0 commit comments

Comments
 (0)