-
-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
push deb and rpm amd64 packages to packagecloud check secret existence before pushing to dockerhub
- Loading branch information
1 parent
7b910a6
commit 90a8a5b
Showing
1 changed file
with
56 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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' }} | ||
|
@@ -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: | | ||
|
@@ -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] | ||
|