Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
paia0720 committed Dec 13, 2024
2 parents b15bb1d + 626f5bc commit c9e5682
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 2 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/clean.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Branch Deleted
on: delete

env:
TAG_NAME: ${{ github.event.ref }}

jobs:
delete:
strategy:
fail-fast: false
matrix:
component:
- name: dbaas-opensearch-adapter
if: github.event.ref_type == 'branch'
runs-on: ubuntu-latest
steps:
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${GITHUB_ACTOR}
password: ${{secrets.GITHUB_TOKEN}}
- name: Prepare Tag
run: echo "TAG_NAME=$(echo ${TAG_NAME} | sed 's@refs/heads/@@;s@/@_@g')" >> $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 }}
- uses: actions/delete-package-versions@v5
with:
package-name: ${{ matrix.component.name }}
package-type: 'container'
package-version-ids: ${{ steps.get-ids-for-delete.outputs.ids-for-delete }}
if: ${{ steps.get-ids-for-delete.outputs.ids-for-delete != '' }}
19 changes: 17 additions & 2 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
branches:
- '**'
env:
TAG_NAME: ${{ github.event.release.tag_name || (github.ref == 'refs/heads/main' && 'main') }}
TAG_NAME: ${{ github.event.release.tag_name || github.ref }}

jobs:
multiplatform_build:
Expand All @@ -30,6 +30,15 @@ jobs:
registry: ghcr.io
username: ${GITHUB_ACTOR}
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: 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 }}
- name: Build and push
uses: docker/build-push-action@v5
with:
Expand All @@ -41,4 +50,10 @@ jobs:
tags: ghcr.io/netcracker/${{ matrix.component.name }}:${{ env.TAG_NAME }}
provenance: false
build-args: |
GH_ACCESS_TOKEN=${{ secrets.GH_ACCESS_TOKEN }}
GH_ACCESS_TOKEN=${{ secrets.GH_ACCESS_TOKEN }}
- uses: actions/delete-package-versions@v5
with:
package-name: ${{ matrix.component.name }}
package-type: 'container'
package-version-ids: ${{ steps.get-ids-for-delete.outputs.ids-for-delete }}
if: ${{ steps.get-ids-for-delete.outputs.ids-for-delete != '' }}

0 comments on commit c9e5682

Please sign in to comment.