diff --git a/.github/workflows/develop.yaml b/.github/workflows/develop.yaml new file mode 100644 index 0000000..ce2fd4e --- /dev/null +++ b/.github/workflows/develop.yaml @@ -0,0 +1,55 @@ +name: Orb Agent - develop +on: + workflow_dispatch: + push: + branches: [ develop ] + paths: + - "agent/**" + - "cmd/**" + - "!agent/docker/**" + +permissions: + contents: write + +env: + GO_VERSION: '1.23' + +jobs: + build-and-push: + runs-on: ubuntu-latest + strategy: + fail-fast: false + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up QEMU + uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf #v3.2.0 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@6524bf65af31da8d45b59e8c27de4bd072b392f5 #v3.8.0 + + - name: Login to Docker Hub + uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 #v3.3.0 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Set build info + run: | + echo ${GITHUB_SHA::7} > ./agent/version/BUILD_COMMIT.txt + LATEST_RELEASE=$(curl --silent "https://api.github.com/repos/${{ github.repository }}/releases/latest" | jq -r '.tag_name') + echo $LATEST_RELEASE > ./agent/version/BUILD_VERSION.txt + + - name: Build image and push + uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 #v6.10.0 + with: + context: . + file: agent/docker/Dockerfile + platforms: linux/amd64, linux/arm64 + push: true + cache-from: type=gha + cache-to: type=gha,mode=max + tags: netboxlabs/orb-agent:develop + build-args: | + GO_VERSION=${{ env.GO_VERSION }} \ No newline at end of file diff --git a/.github/workflows/build.yaml b/.github/workflows/tests.yaml similarity index 56% rename from .github/workflows/build.yaml rename to .github/workflows/tests.yaml index 55fa36c..890aa9f 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/tests.yaml @@ -1,9 +1,8 @@ -name: Orb Agent - build +name: Orb Agent - tests on: push: branches: - "!release" - - "develop" paths: - "agent/**" - "cmd/**" @@ -18,9 +17,6 @@ concurrency: group: ${{ github.workflow }} cancel-in-progress: false -env: - GO_VERSION: '1.23' - permissions: contents: write pull-requests: write @@ -73,45 +69,4 @@ jobs: Go test coverage ${{ steps.go-test.outputs.coverage-report }} Total coverage: ${{ steps.go-test.outputs.coverage-total }}% - edit-mode: replace - - build-and-push: - needs: go-test - runs-on: ubuntu-latest - if: success() && github.ref == 'refs/heads/develop' - strategy: - fail-fast: false - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Set up QEMU - uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf #v3.2.0 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@6524bf65af31da8d45b59e8c27de4bd072b392f5 #v3.8.0 - - - name: Login to Docker Hub - uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 #v3.3.0 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Set build info - run: | - echo ${GITHUB_SHA::7} > ./agent/version/BUILD_COMMIT.txt - LATEST_RELEASE=$(curl --silent "https://api.github.com/repos/${{ github.repository }}/releases/latest" | jq -r '.tag_name') - echo $LATEST_RELEASE > ./agent/version/BUILD_VERSION.txt - - - name: Build image and push - uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 #v6.10.0 - with: - context: . - file: agent/docker/Dockerfile - platforms: linux/amd64, linux/arm64 - push: true - cache-from: type=gha - cache-to: type=gha,mode=max - tags: netboxlabs/orb-agent:develop - build-args: | - GO_VERSION=${{ env.GO_VERSION }} \ No newline at end of file + edit-mode: replace \ No newline at end of file