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

Build using the Okteto Build GitHub Action #6

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
44 changes: 44 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Build
on:
pull_request:
branches: master
push:
branches:
- master
release:
types:
- published

jobs:
build:
runs-on: ubuntu-latest
steps:

- name: Check out code
uses: actions/checkout@v2

- name: Okteto Context
uses: okteto/context@latest
with:
url: ${{ secrets.OKTETO_PRODUCT_URL }}
token: ${{ secrets.OKTETO_PRODUCT_TOKEN }}

- name: Login to DockerHub
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We could define these credentials in product.okteto.dev, but that would give us push permissions when running okteto build locally. I think it's more secured to define these credentials as GiHub secrets

Copy link
Member

Choose a reason for hiding this comment

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

Agree, I think it is better to keep them as GitHub secrets

if: ${{ github.event_name == 'release' }}
uses: azure/docker-login@v1
with:
username: '${{ secrets.DOCKER_USER }}'
password: '${{ secrets.DOCKER_PASS }}'

- id: tag
name: Image Tag
if: ${{ github.event_name == 'release' }}
run: echo ::set-output name=TAG::okteto/clean:${GITHUB_REF#refs/tags/}

- name: Okteto Build
uses: okteto/build@latest
with:
file: Dockerfile
buildargs: "COMMIT_SHA=${{ github.sha }}"
platform: linux/amd64,linux/arm64
tag: ${{ steps.tag.outputs.TAG }}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can push to more than one registry if the Okteto CLI supports multi-tag builds

49 changes: 0 additions & 49 deletions .github/workflows/ci.yml

This file was deleted.