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 1a4459c commit 35def97
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 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 @@ -15,11 +19,14 @@ 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
Expand Down

0 comments on commit 35def97

Please sign in to comment.