Skip to content

Commit

Permalink
tests should be executed for all branches, but dockerhub push only in…
Browse files Browse the repository at this point in the history
… main, when tests complete
  • Loading branch information
zostaw committed Dec 2, 2023
1 parent 723be85 commit 39f634d
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 38 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/push_dockerhub.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Dockerhub Push

on:
workflow_run:
workflows: ["Run Tests"]
branches: [main]
types:
- completed

jobs:
build_and_push:
needs: test
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
submodules: true
token: ${{ secrets.CI_TOKEN }}

- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: . # Path to the Dockerfile
push: true
platforms: linux/arm/v6,linux/arm/v8,linux/arm64,linux/amd64
tags: |
zostaw/multiarch-home-page:latest
zostaw/multiarch-home-page:${{ github.sha }}
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
name: Docker Image CI
name: Run Tests

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
on: [push, pull_request]

jobs:
test:
test_page_initiation:
runs-on: ubuntu-latest
steps:
- name: Checkout code
Expand Down Expand Up @@ -49,34 +45,3 @@ jobs:
name: reports
path: reports

build:
needs: test
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
submodules: true
token: ${{ secrets.CI_TOKEN }}

- name: Set up QEMU
uses: docker/setup-qemu-action@v1

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Login to Docker Hub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Build and push Docker image
uses: docker/build-push-action@v2
with:
context: . # Path to the Dockerfile
push: true
platforms: linux/arm/v6,linux/arm/v8,linux/arm64,linux/amd64
tags: |
zostaw/multiarch-home-page:latest
zostaw/multiarch-home-page:${{ github.sha }}

0 comments on commit 39f634d

Please sign in to comment.