Skip to content

Commit

Permalink
feat(deploy): Switch to GitHub Container Registry
Browse files Browse the repository at this point in the history
  • Loading branch information
LoicGombeaud committed Sep 16, 2023
1 parent e9137cc commit 2e716d7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
21 changes: 15 additions & 6 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
name: Build, push, deploy

env:
DOCKER_REGISTRY: ghcr.io
IMAGE_REPOSITORY: compteurs-velo

on:
push:
branches:
Expand All @@ -14,19 +18,24 @@ jobs:
steps:
- uses: actions/checkout@v4
- run: echo ${{ secrets.ENV_LOCAL }} | base64 -d > .env.local
- run: echo ${{ secrets.DOCKER_HUB_TOKEN }} | docker login -u loicag --password-stdin
- run: docker build . -t loicag/compteurs-velo:latest
- run: docker build . -t loicag/compteurs-velo:$(date +%F)
- run: docker push loicag/compteurs-velo:latest
- run: docker push loicag/compteurs-velo:$(date +%F)
- run: echo ${{ secrets.GITHUB_TOKEN }} | docker login -u $ --password-stdin $DOCKER_REGISTRY
- run: |
IMAGE_NAME=$DOCKER_REGISTRY/${{ github.repository_owner }}/$IMAGE_REPOSITORY
IMAGE_NAME=$(echo $IMAGE_NAME | tr '[A-Z]' '[a-z]') # to lowercase
docker build . -t $IMAGE_NAME:latest
docker build . -t $IMAGE_NAME:$(date +%F)
docker push $IMAGE_NAME:latest
docker push $IMAGE_NAME:$(date +%F)
deploy:
needs: build
name: Deploy the new image
runs-on: ubuntu-latest
steps:
- run: >
IMAGE_NAME=$DOCKER_REGISTRY/${{ github.repository_owner }}/$IMAGE_REPOSITORY
IMAGE_NAME=$(echo $IMAGE_NAME | tr '[A-Z]' '[a-z]') # to lowercase
curl
-u admin:${{ secrets.KEEL_PASSWORD }}
-d '{"name":"loicag/compteurs-velo", "tag":"latest"}'
-d "{'name':'$IMAGE_NAME', 'tag':'latest'}"
-H "Content-Type: application/json"
-X POST https://keel.loicgombeaud.com/v1/webhooks/native
2 changes: 1 addition & 1 deletion deploy/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

replicaCount: 1
image:
repository: loicag/compteurs-velo
repository: ghcr.io/loicgombeaud/compteurs-velo
tag: latest
pullPolicy: Always
annotations:
Expand Down

0 comments on commit 2e716d7

Please sign in to comment.