Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

make docker build optinal from release workflow #399

Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .github/workflows/build-docker.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Build Docker

on:
workflow_dispatch:
inputs:
tag:
description: Tag for release
required: true

jobs:
build-docker:
name: Build and Publis to Docker Hub
runs-on: ubuntu-latest
needs: build-binary
steps:
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Checkout
uses: actions/checkout@v2
with:
ref: ${{ github.event.inputs.tag }}
- name: Download binary
uses: actions/download-artifact@v2
with:
name: oak-collator
- name: Build
run: |
tag=${{ github.event.inputs.tag }}
docker_tag="${tag:1}"
docker build -f ./docker/turing/Dockerfile -t oaknetwork/turing:$docker_tag .
docker tag oaknetwork/turing:$docker_tag oaknetwork/turing:latest
docker push oaknetwork/turing:$docker_tag
docker push oaknetwork/turing:latest

36 changes: 14 additions & 22 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ on:
tag:
description: Tag for release
required: true
draft:
description: draf release will not make the final image and skip some particular steps
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

darf release? 😅

skip some particular steps is vauge. Let’s avoid wordings like this and explain the most important things here.

Is it will not build and publish a Docker image on Dockerhub?

type: boolean
required: true

jobs:
build-binary:
Expand Down Expand Up @@ -33,6 +37,7 @@ jobs:
with:
name: oak-collator
path: artifacts/

build-runtime:
name: Build Runtime
runs-on: ubuntu-latest
Expand Down Expand Up @@ -62,32 +67,19 @@ jobs:
path: |
${{ matrix.chain }}-runtime.wasm
${{ matrix.chain }}-srtool-digest.json

build-docker:
name: Build Docker
runs-on: ubuntu-latest
needs: build-binary
steps:
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Checkout
uses: actions/checkout@v2
with:
ref: ${{ github.event.inputs.tag }}
- name: Download binary
uses: actions/download-artifact@v2
with:
name: oak-collator
- name: Build
run: |
tag=${{ github.event.inputs.tag }}
docker_tag="${tag:1}"
docker build -f ./docker/turing/Dockerfile -t oaknetwork/turing:$docker_tag .
docker tag oaknetwork/turing:$docker_tag oaknetwork/turing:latest
docker push oaknetwork/turing:$docker_tag
docker push oaknetwork/turing:latest
use: ./.github/workflows/build-docker.yml
with:
tag: ${{ github.event.inputs.tag }}
secrets:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
if: github.event.inputs.draft == 'true'
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chrisli30 I extract into a standalone job so we can run it separately, but at the same time I run this optinally so we don't need to remember to run 2 jobs.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm I think we can remove it from this Release script, because the Docker publish job doesn’t need to run until the very end of the release, and as you said, the image is optional when upgrading Turing Network. The two jobs are not supposed to run simultaneously and have different priorities.


release:
name: Release
runs-on: ubuntu-latest
Expand Down
Loading