Browse Source

github: refresh alpine workflow [skip ci]

Victor Seva 1 year ago
parent
commit
9b72b6dd4f
1 changed files with 22 additions and 24 deletions
  1. 22 24
      .github/workflows/alpine.yml

+ 22 - 24
.github/workflows/alpine.yml

@@ -6,17 +6,22 @@ on:
   push:
   push:
     tags:
     tags:
     - '[0-9]+.[0-9]+.[0-9]+'
     - '[0-9]+.[0-9]+.[0-9]+'
+  # Allows you to run this workflow manually from the Actions tab
+  workflow_dispatch:
 
 
 env:
 env:
   IMAGE_NAME: kamailio-ci
   IMAGE_NAME: kamailio-ci
   SOURCE_BRANCH: ${{ github.ref_name }}
   SOURCE_BRANCH: ${{ github.ref_name }}
+  DOCKER_REPO: ghcr.io/kamailio/kamailio-ci
 
 
 jobs:
 jobs:
   x86_64:
   x86_64:
     runs-on: ubuntu-latest
     runs-on: ubuntu-latest
-
+    permissions:
+      contents: read
+      packages: write 
     steps:
     steps:
-    - uses: actions/checkout@v3
+    - uses: actions/checkout@v4
 
 
     - name: print latest_commit
     - name: print latest_commit
       run: echo ${{ github.sha }}
       run: echo ${{ github.sha }}
@@ -29,6 +34,14 @@ jobs:
       if: ${{ github.event_name == 'schedule' }}
       if: ${{ github.event_name == 'schedule' }}
       run: test -z "$(git rev-list --after='24 hours' ${{ github.sha }})" && echo "should_run=false" >> $GITHUB_OUTPUT || echo "should_run=true" >> $GITHUB_OUTPUT
       run: test -z "$(git rev-list --after='24 hours' ${{ github.sha }})" && echo "should_run=false" >> $GITHUB_OUTPUT || echo "should_run=true" >> $GITHUB_OUTPUT
 
 
+    - name: Login to GitHub Container Registry
+      if: ${{ steps.should_run.outputs.should_run != 'false' }}
+      uses: docker/login-action@v3
+      with:
+        registry: ghcr.io
+        username: ${{ github.repository_owner }}
+        password: ${{ secrets.GITHUB_TOKEN }}
+
     - name: Compile Kamailio source
     - name: Compile Kamailio source
       if: ${{ steps.should_run.outputs.should_run != 'false' }}
       if: ${{ steps.should_run.outputs.should_run != 'false' }}
       run: |
       run: |
@@ -40,7 +53,7 @@ jobs:
     - name: Docker meta
     - name: Docker meta
       if: ${{ steps.should_run.outputs.should_run != 'false' }}
       if: ${{ steps.should_run.outputs.should_run != 'false' }}
       id: meta
       id: meta
-      uses: docker/metadata-action@v4
+      uses: docker/metadata-action@v5
       with:
       with:
         # list of Docker images to use as base name for tags
         # list of Docker images to use as base name for tags
         images: |
         images: |
@@ -58,7 +71,7 @@ jobs:
     - name: Docker meta "-alpine"
     - name: Docker meta "-alpine"
       if: ${{ steps.should_run.outputs.should_run != 'false' }}
       if: ${{ steps.should_run.outputs.should_run != 'false' }}
       id: meta-alpine
       id: meta-alpine
-      uses: docker/metadata-action@v4
+      uses: docker/metadata-action@v5
       with:
       with:
         # list of Docker images to use as base name for tags
         # list of Docker images to use as base name for tags
         images: |
         images: |
@@ -76,7 +89,7 @@ jobs:
     - name: Docker meta "-debug"
     - name: Docker meta "-debug"
       if: ${{ steps.should_run.outputs.should_run != 'false' }}
       if: ${{ steps.should_run.outputs.should_run != 'false' }}
       id: meta-debug
       id: meta-debug
-      uses: docker/metadata-action@v4
+      uses: docker/metadata-action@v5
       with:
       with:
         # list of Docker images to use as base name for tags
         # list of Docker images to use as base name for tags
         images: |
         images: |
@@ -91,14 +104,6 @@ jobs:
           suffix=-debug
           suffix=-debug
           latest=false
           latest=false
 
 
-    - name: Login to GitHub Container Registry
-      if: ${{ steps.should_run.outputs.should_run != 'false' }}
-      uses: docker/login-action@v2
-      with:
-        registry: ghcr.io
-        username: ${{ github.repository_owner }}
-        password: ${{ secrets.GITHUB_TOKEN }}
-
     - name: temporal workarround for "-alpine" and "-debug" builds
     - name: temporal workarround for "-alpine" and "-debug" builds
       if: ${{ steps.should_run.outputs.should_run != 'false' }}
       if: ${{ steps.should_run.outputs.should_run != 'false' }}
       run: |
       run: |
@@ -127,14 +132,14 @@ jobs:
     - name: Create custom builder for "-debug" build
     - name: Create custom builder for "-debug" build
       if: ${{ steps.should_run.outputs.should_run != 'false' }}
       if: ${{ steps.should_run.outputs.should_run != 'false' }}
       id: local-repo
       id: local-repo
-      uses: docker/setup-buildx-action@v2
+      uses: docker/setup-buildx-action@v3
       with:
       with:
         driver-opts: |
         driver-opts: |
           network=kamailio-build
           network=kamailio-build
 
 
     - name: Build and push "-debug" build
     - name: Build and push "-debug" build
       if: ${{ steps.should_run.outputs.should_run != 'false' }}
       if: ${{ steps.should_run.outputs.should_run != 'false' }}
-      uses: docker/build-push-action@v4
+      uses: docker/build-push-action@v5
       with:
       with:
         context: pkg/docker/alpine
         context: pkg/docker/alpine
         file: pkg/docker/alpine/Dockerfile.debug
         file: pkg/docker/alpine/Dockerfile.debug
@@ -153,7 +158,7 @@ jobs:
 
 
     - name: Build and push "-alpine" build
     - name: Build and push "-alpine" build
       if: ${{ steps.should_run.outputs.should_run != 'false' }}
       if: ${{ steps.should_run.outputs.should_run != 'false' }}
-      uses: docker/build-push-action@v4
+      uses: docker/build-push-action@v5
       with:
       with:
         context: pkg/docker/alpine
         context: pkg/docker/alpine
         file: pkg/docker/alpine/Dockerfile.alpine
         file: pkg/docker/alpine/Dockerfile.alpine
@@ -163,17 +168,10 @@ jobs:
 
 
     - name: Build and push
     - name: Build and push
       if: ${{ steps.should_run.outputs.should_run != 'false' }}
       if: ${{ steps.should_run.outputs.should_run != 'false' }}
-      uses: docker/build-push-action@v4
+      uses: docker/build-push-action@v5
       with:
       with:
         context: pkg/docker/alpine
         context: pkg/docker/alpine
         file: pkg/docker/alpine/Dockerfile
         file: pkg/docker/alpine/Dockerfile
         push: ${{ github.event_name != 'pull_request' }}
         push: ${{ github.event_name != 'pull_request' }}
         tags: ${{ steps.meta.outputs.tags }}
         tags: ${{ steps.meta.outputs.tags }}
         labels: ${{ steps.meta.outputs.labels }}
         labels: ${{ steps.meta.outputs.labels }}
-
-    - name: Delete untagged images
-      if: ${{ steps.should_run.outputs.should_run != 'false' }}
-      uses: camargo/delete-untagged-action@v1
-      with:
-        github-token: ${{ secrets.GITHUB_TOKEN }}
-        package-name: ${{ env.IMAGE_NAME }}