diff --git a/.github/workflows/clean.yml b/.github/workflows/clean.yml index d49fe5c..5a47710 100644 --- a/.github/workflows/clean.yml +++ b/.github/workflows/clean.yml @@ -10,7 +10,8 @@ jobs: fail-fast: false matrix: component: - - name: qubership-opensearch-dbaas-adapter + - name: qubership-backup-daemon + base: alpine if: github.event.ref_type == 'branch' runs-on: ubuntu-latest steps: @@ -27,8 +28,8 @@ jobs: uses: Netcracker/get-package-ids@v0.0.1 with: component-name: ${{ matrix.component.name }} - component-tag: ${{ env.TAG_NAME }} - access-token: ${{ secrets.GH_ACCESS_TOKEN }} + component-tag: ${{ env.TAG_NAME }}_${{ matrix.component.base }} + access-token: ${{ secrets.GITHUB_TOKEN }} - uses: actions/delete-package-versions@v5 with: package-name: ${{ matrix.component.name }} diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 82d15cf..a430bae 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -5,8 +5,17 @@ on: push: branches: - '**' + workflow_dispatch: + inputs: + publish_docker: + description: "Publish image to ghcr.io" + type: boolean + default: true + required: false env: TAG_NAME: ${{ github.event.release.tag_name || github.ref }} + PUSH: ${{ (github.event_name == 'workflow_dispatch' && inputs.publish_docker) || !startsWith(github.ref, 'refs/heads/dependabot') }} + GITHUB_GROUP: ${{ github.repository_owner }} jobs: multiplatform_build: @@ -14,8 +23,9 @@ jobs: fail-fast: false matrix: component: - - name: qubership-opensearch-dbaas-adapter - file: docker/Dockerfile + - name: qubership-backup-daemon + file: alpine/Dockerfile + base: alpine runs-on: ubuntu-latest steps: - name: Checkout @@ -32,25 +42,26 @@ jobs: password: ${{secrets.GITHUB_TOKEN}} - name: Prepare Tag run: echo "TAG_NAME=$(echo ${TAG_NAME} | sed 's@refs/tags/@@;s@refs/heads/@@;s@/@_@g')" >> $GITHUB_ENV + - name: Prepare Group + run: echo "GITHUB_GROUP=${GITHUB_GROUP,,}" >> $GITHUB_ENV - name: Get package IDs for delete id: get-ids-for-delete uses: Netcracker/get-package-ids@v0.0.1 with: component-name: ${{ matrix.component.name }} - component-tag: ${{ env.TAG_NAME }} - access-token: ${{ secrets.GH_ACCESS_TOKEN }} + component-tag: ${{ env.TAG_NAME }}_${{ matrix.component.base }} + access-token: ${{ secrets.GITHUB_TOKEN }} + if: ${{ env.PUSH }} - name: Build and push uses: docker/build-push-action@v5 with: no-cache: true - context: ${{ matrix.component.context }} + context: ${{ matrix.component.dir }} file: ${{ matrix.component.file }} platforms: linux/amd64,linux/arm64 push: true - tags: ghcr.io/netcracker/${{ matrix.component.name }}:${{ env.TAG_NAME }} + tags: ghcr.io/${{ env.GITHUB_GROUP }}/${{ matrix.component.name }}:${{ env.TAG_NAME }}_${{ matrix.component.base }} provenance: false - build-args: | - GH_ACCESS_TOKEN=${{ secrets.GH_ACCESS_TOKEN }} - uses: actions/delete-package-versions@v5 with: package-name: ${{ matrix.component.name }}