Skip to content

Commit

Permalink
Update docker-publish.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
rmoesbergen authored Apr 7, 2024
1 parent 981a40c commit 20211cc
Showing 1 changed file with 25 additions and 14 deletions.
39 changes: 25 additions & 14 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,29 @@ jobs:
steps:
- uses: actions/checkout@v4

- name: Build image
run: docker build . --file Dockerfile --tag $IMAGE_NAME

- name: Log into registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login docker.pkg.github.com -u ${{ github.actor }} --password-stdin

- name: Push image
run: |
IMAGE_ID=docker.pkg.github.com/djoamersfoort/infobord/$IMAGE_NAME
- name: Docker Login
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
file: Dockerfile
context: .
push: true
tags: ghcr.io/djoamersfoort/infobord/infobord:latest

# Use Docker `latest` tag convention
VERSION=latest
docker tag $IMAGE_NAME $IMAGE_ID:$VERSION
docker push $IMAGE_ID:$VERSION
- name: Redeploy
run: |
curl https://portainer.djoamersfoort.nl/hooks/update-docker-image?stack=infobord -H "X-Token: ${{ secrets.WEBHOOK_TOKEN }}"
- name: Clean up old images
uses: actions/delete-package-versions@v5
with:
package-name: 'infobord/infobord'
package-type: 'container'
min-versions-to-keep: 5
delete-only-untagged-versions: 'true'

0 comments on commit 20211cc

Please sign in to comment.