Skip to content

Commit

Permalink
New build process
Browse files Browse the repository at this point in the history
  • Loading branch information
mrMigles committed Dec 13, 2024
1 parent 1d4b305 commit 82a43e9
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 1 deletion.
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: consul-backup-daemon
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/[email protected]
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 != '' }}
17 changes: 16 additions & 1 deletion .github/workflows/push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
branches:
- 'main'
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/[email protected]
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 @@ -40,3 +49,9 @@ jobs:
push: true
tags: ghcr.io/netcracker/${{ matrix.component.name }}:${{ env.TAG_NAME }}
provenance: false
- 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 82a43e9

Please sign in to comment.