Skip to content

Commit

Permalink
misc(ci/cd): Use stdin-pass to login to ghcr & change latest tag to dev
Browse files Browse the repository at this point in the history
  • Loading branch information
xyzuan committed Nov 4, 2024
1 parent a8a81bb commit cfd0658
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions .github/workflows/build-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Log in to Github Container Registry
run: echo "${{ secrets.GH_TOKEN }}" | docker login -u "${{ github.actor }}" ghcr.io --password-stdin

- name: Build Docker image
run: |
docker build \
Expand All @@ -38,15 +41,14 @@ jobs:
--build-arg CLOUDINARY_CLOUD_NAME=${{ secrets.CLOUDINARY_CLOUD_NAME }} \
--build-arg CLOUDINARY_API_KEY=${{ secrets.CLOUDINARY_API_KEY }} \
--build-arg CLOUDINARY_API_SECRET=${{ secrets.CLOUDINARY_API_SECRET }} \
-t ghcr.io/xyzuan/xyzuan_api_v2:latest -f misc/Dockerfile.dev .
-t ghcr.io/xyzuan/xyzuan_api_v2:dev -f misc/Dockerfile.dev .
- name: Tag Docker image
run: |
IMAGE_NAME=ghcr.io/xyzuan/xyzuan_api_v2
docker tag $IMAGE_NAME:latest $IMAGE_NAME:$(echo "${{ github.sha }}" | head -c 7)
docker tag $IMAGE_NAME:dev $IMAGE_NAME:$(echo "${{ github.sha }}" | head -c 7)
- name: Push Docker image
run: |
docker login --username xyzuan --password ${{ secrets.GH_TOKEN }} ghcr.io
docker push ghcr.io/xyzuan/xyzuan_api_v2:latest
docker push ghcr.io/xyzuan/xyzuan_api_v2:dev
docker push ghcr.io/xyzuan/xyzuan_api_v2:$(echo "${{ github.sha }}" | head -c 7)

0 comments on commit cfd0658

Please sign in to comment.