Skip to content

Commit

Permalink
Docker workflow (test branches)
Browse files Browse the repository at this point in the history
 - non-master branches / non tag get tested, and artifact saved
 - versions update
  • Loading branch information
DrYak committed Oct 13, 2023
1 parent dc93bfd commit eb0d311
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 21 deletions.
42 changes: 21 additions & 21 deletions .github/workflows/deploy-docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ on:
- master
tags:
- 'v*'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
Expand All @@ -18,35 +23,30 @@ jobs:
packages: write

steps:
-
name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
-
name: Set up QEMU
uses: docker/setup-qemu-action@v1
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
-
name: Log in to the Container registry
uses: docker/login-action@v1 #.10.0
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

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

- name: Log in to the Container registry
uses: docker/login-action@v3
if: contains(github.ref, 'master') || contains(github.ref, 'tags')
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
-
name: Extract metadata (tags, labels) for Docker

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v3 #.5.0
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
-
name: Build and push

- name: Build and push
id: docker_build
uses: docker/build-push-action@v2 #.7.0
uses: docker/build-push-action@v5
with:
push: true
push: ${{ contains(github.ref, 'master') || contains(github.ref, 'tags') }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
47 changes: 47 additions & 0 deletions .github/workflows/test-docker.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Test Docker image

on:
push:
branches:
- '*'
- '!master'

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }}

jobs:
docker:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

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

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

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and save
id: docker_build
uses: docker/build-push-action@v5
with:
push: ${{ contains(github.ref, 'master') || contains(github.ref, 'tags') }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
outputs: type=docker,dest=/tmp/vpipe-docker.tar

- name: Upload artifact
uses: actions/upload-artifact@v3
if: "( !contains(github.ref, 'master') && !contains(github.ref, 'tags') )"
with:
name: vpipe-docker
path: /tmp/vpipe-docker.tar

0 comments on commit eb0d311

Please sign in to comment.