Skip to content

Commit

Permalink
Update ghcr.yml (#557)
Browse files Browse the repository at this point in the history
push deb and rpm amd64 packages to packagecloud
check secret existence before pushing to dockerhub
  • Loading branch information
bilalrao12 authored Oct 8, 2024
1 parent 7b910a6 commit 90a8a5b
Showing 1 changed file with 56 additions and 1 deletion.
57 changes: 56 additions & 1 deletion .github/workflows/ghcr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,40 @@ jobs:
with:
args: 'heplify-server*'

- name: Check PACKAGECLOUD secret presence
id: checkpackagecloud
shell: bash
run: |
if [ "$SECRET" == "" ] || [ "$USERNAME" == "" ]; then
echo "secretspresent=false" >> $GITHUB_OUTPUT
else
echo "secretspresent=true" >> $GITHUB_OUTPUT
fi
env:
SECRET: ${{ secrets.PACKAGECLOUD_TOKEN }}
USERNAME: ${{ secrets.PACKAGECLOUD_USERNAME }}

- name: upload deb packagecloud
if: ${{ matrix.arch != 'aarch64' && steps.checkpackagecloud.outputs.secretspresent == 'true' }}
uses: danielmundi/upload-packagecloud@v1
with:
PACKAGE-NAME: heplify-server-*-amd64.deb
PACKAGECLOUD-REPO: sipcapture
PACKAGECLOUD-DISTRIB: any/any
PACKAGECLOUD-USERNAME: ${{ secrets.PACKAGECLOUD_USERNAME }}
PACKAGECLOUD-TOKEN: ${{ secrets.PACKAGECLOUD_TOKEN }}
continue-on-error: true

- name: upload rpm packagecloud
if: ${{ matrix.arch != 'aarch64' && steps.checkpackagecloud.outputs.secretspresent == 'true' }}
uses: danielmundi/upload-packagecloud@v1
with:
PACKAGE-NAME: heplify-server-*-amd64.rpm
PACKAGECLOUD-REPO: sipcapture
PACKAGECLOUD-DISTRIB: rpm_any/rpm_any
PACKAGECLOUD-USERNAME: ${{ secrets.PACKAGECLOUD_USERNAME }}
PACKAGECLOUD-TOKEN: ${{ secrets.PACKAGECLOUD_TOKEN }}
continue-on-error: true

docker-ghcr-push:
if: ${{ github.event_name != 'workflow_dispatch' }}
Expand Down Expand Up @@ -120,6 +154,19 @@ jobs:
contents: read

steps:
- name: Check Docker secret presence
id: checkdocker
shell: bash
run: |
if [ "$SECRET" == "" ] || [ "$USERNAME" == "" ]; then
echo "secretspresent=false" >> $GITHUB_OUTPUT
else
echo "secretspresent=true" >> $GITHUB_OUTPUT
fi
env:
SECRET: ${{ secrets.DOCKERHUB_TOKEN }}
USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}

- uses: actions/checkout@v3
- name: Version Check
run: |
Expand All @@ -133,10 +180,18 @@ jobs:
uses: docker/[email protected]

- name: Login to DockerHub
id: logintodocker
if: ${{ steps.checkdocker.outputs.secretspresent == 'true' }}
uses: docker/[email protected]
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Exit if credentials doesn't exist
if: ${{ steps.checkdocker.outputs.secretspresent == 'false' }}
run: |
echo "can not proceed"
exit 1
- name: Build and push to DockerHub
uses: docker/[email protected]
Expand Down

0 comments on commit 90a8a5b

Please sign in to comment.