Skip to content

Commit 91f9f01

Browse files
committed
Update Docker and Main Pipeline workflows to adjust permissions and image tags
1 parent 36a1afc commit 91f9f01

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

.github/workflows/docker.yml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@ on:
1414
description: "Docker image tag"
1515
value: ${{ jobs.docker-build.outputs.image-tag }}
1616

17+
permissions:
18+
contents: read
19+
packages: write
20+
id-token: write
21+
1722
env:
1823
MONGO_URI: ${{ secrets.MONGO_URI }}
1924
MONGO_USERNAME: ${{ secrets.MONGO_USERNAME }}
@@ -43,15 +48,15 @@ jobs:
4348
uses: docker/login-action@v3
4449
with:
4550
registry: ghcr.io
46-
username: ${{ github.repository_owner }}
51+
username: ${{ github.actor }}
4752
password: ${{ secrets.GITHUB_TOKEN }}
4853

4954
- name: Build Docker Image
5055
uses: docker/build-push-action@v6
5156
with:
5257
push: false
5358
tags: |
54-
ghcr.io/${{ secrets.DOCKER_USERNAME }}/solar-system:${{ github.sha }}
59+
ghcr.io/${{ secrets.DOCKER_USERNAME }}/graduation-project-devops:${{ github.sha }}
5560
5661
- name: Test Docker Image
5762
run: |
@@ -63,7 +68,7 @@ jobs:
6368
-e MONGO_URI=${{ secrets.MONGO_URI }} \
6469
-e MONGO_USERNAME=${{ secrets.MONGO_USERNAME }} \
6570
-e MONGO_PASSWORD=${{ secrets.MONGO_PASSWORD }} \
66-
ghcr.io/${{ secrets.DOCKER_USERNAME }}/solar-system:${{ github.sha }}
71+
ghcr.io/${{ secrets.DOCKER_USERNAME }}/graduation-project-devops:${{ github.sha }}
6772
6873
# Wait for container to start
6974
sleep 15
@@ -98,4 +103,4 @@ jobs:
98103
push: true
99104
tags: |
100105
docker.io/${{ secrets.DOCKER_USERNAME }}/solar-system:${{ github.sha }}
101-
ghcr.io/${{ secrets.DOCKER_USERNAME }}/solar-system:${{ github.sha }}
106+
ghcr.io/${{ secrets.DOCKER_USERNAME }}/graduation-project-devops:${{ github.sha }}

.github/workflows/main-pipeline.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ on:
3131
permissions:
3232
contents: read
3333
packages: write
34+
id-token: write
3435

3536
jobs:
3637
ci:
@@ -43,6 +44,10 @@ jobs:
4344
name: Build Docker Image
4445
if: ${{ !inputs.skip-docker && (success() || inputs.skip-tests) }}
4546
needs: [ci]
47+
permissions:
48+
contents: read
49+
packages: write
50+
id-token: write
4651
uses: ./.github/workflows/docker.yml
4752
secrets: inherit
4853
with:

0 commit comments

Comments
 (0)