From c635843144ea7d17eeb97e84b5bc7e04bb95de95 Mon Sep 17 00:00:00 2001 From: Pablo Chico de Guzman Date: Tue, 28 Nov 2023 21:44:13 +0100 Subject: [PATCH] Build using the Okteo Build GitHub Action --- .github/workflows/build.yml | 44 +++++++++++++++++++++++++++++++++ .github/workflows/ci.yml | 49 ------------------------------------- 2 files changed, 44 insertions(+), 49 deletions(-) create mode 100644 .github/workflows/build.yml delete mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..9ece20c --- /dev/null +++ b/.github/workflows/build.yml @@ -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 + 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 }} diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index 87aef19..0000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,49 +0,0 @@ -name: Go -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 - - - uses: azure/docker-login@v1 - with: - username: '${{ secrets.DOCKER_USER }}' - password: '${{ secrets.DOCKER_PASS }}' - - - name: Set up Docker Buildx - uses: crazy-max/ghaction-docker-buildx@v3 - with: - qemu-version: latest - buildx-version: latest - - - name: "Build" - run: | - docker buildx build \ - --platform linux/amd64,linux/arm64,linux/arm/v7 \ - --output "type=image,push=false" \ - --build-arg COMMIT_SHA=${{ github.sha }} -t clean:${{ github.sha }} . - - - id: tag - name: Get the tag - run: echo ::set-output name=TAG::${GITHUB_REF#refs/tags/} - if: ${{ github.event_name == 'release' }} - - - name: "Push" - run: | - docker buildx build \ - --platform linux/amd64,linux/arm64,linux/arm/v7 \ - --output "type=image,push=true" \ - --build-arg COMMIT_SHA=${{ github.sha }} -t okteto/clean:${{ steps.tag.outputs.TAG }} . - if: ${{ github.event_name == 'release' }}