Skip to content

chore(deps): bump docker/login-action from 3 to 4 #49

chore(deps): bump docker/login-action from 3 to 4

chore(deps): bump docker/login-action from 3 to 4 #49

Workflow file for this run

name: Docker Image CI
on:
push:
branches: [ "main" ]
tags: [ "v*.*.*" ]
pull_request:
branches: [ "main" ]
permissions:
packages: write
contents: write
env:
GHCR_IMAGE: ghcr.io/${{ github.repository }}
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to GitHub Container Registry
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push to GHCR
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: ${{ env.GHCR_IMAGE }}:${{ github.sha }}
cache-from: type=gha
cache-to: type=gha,mode=max
test:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Log in to GitHub Container Registry
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Pull image for testing
run: docker pull ${{ env.GHCR_IMAGE }}:${{ github.sha }}
- name: Run E2E Startup Test
run: ./scripts/test-startup.sh ${{ env.GHCR_IMAGE }}:${{ github.sha }}
- name: Show logs on failure
if: failure()
run: |
docker ps -a
# The container name has a timestamp, so we list all to find it
docker logs $(docker ps -a -q --filter ancestor=${{ env.GHCR_IMAGE }}:${{ github.sha }}) || true
publish:
needs: test
if: startsWith(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
steps:
- name: Log in to GitHub Container Registry
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Log in to Docker Hub
uses: docker/login-action@v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Pull image from GHCR
run: docker pull ${{ env.GHCR_IMAGE }}:${{ github.sha }}
- name: Tag and push to Docker Hub
run: |
TAG_NAME=${GITHUB_REF#refs/tags/}
DOCKERHUB_REPO="${{ secrets.DOCKERHUB_USERNAME }}/vrising-dedicated"
docker tag ${{ env.GHCR_IMAGE }}:${{ github.sha }} $DOCKERHUB_REPO:latest
docker tag ${{ env.GHCR_IMAGE }}:${{ github.sha }} $DOCKERHUB_REPO:$TAG_NAME
docker push $DOCKERHUB_REPO:latest
docker push $DOCKERHUB_REPO:$TAG_NAME
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true