Skip to content

Commit

Permalink
feat: test dockerhub
Browse files Browse the repository at this point in the history
  • Loading branch information
vitorfdl committed Jun 18, 2024
1 parent f7606a3 commit 613dc96
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 14 deletions.
17 changes: 3 additions & 14 deletions .github/workflows/build-dockerhub.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ jobs:
build:
runs-on: ubuntu-latest
environment: PROD
env:
CARGO_SERVER_SSL_CA: ${{ secrets.SERVER_SSL_CA }}
CARGO_SERVER_SSL_CERT: ${{ secrets.SERVER_SSL_CERT }}
CARGO_SERVER_SSL_KEY: ${{ secrets.SERVER_SSL_KEY }}

steps:
- name: Checkout the code
Expand All @@ -34,16 +30,9 @@ jobs:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Convert environment variables to Base64
id: convert_env
run: |
echo "::set-env name=CARGO_SERVER_SSL_CA_BASE64::$(echo -n $CARGO_SERVER_SSL_CA | base64)"
echo "::set-env name=CARGO_SERVER_SSL_CERT_BASE64::$(echo -n $CARGO_SERVER_SSL_CERT | base64)"
echo "::set-env name=CARGO_SERVER_SSL_KEY_BASE64::$(echo -n $CARGO_SERVER_SSL_KEY | base64)"
- name: Build and deploy images
env:
CARGO_SERVER_SSL_CA_BASE64: ${{ env.CARGO_SERVER_SSL_CA_BASE64 }}
CARGO_SERVER_SSL_CERT_BASE64: ${{ env.CARGO_SERVER_SSL_CERT_BASE64 }}
CARGO_SERVER_SSL_KEY_BASE64: ${{ env.CARGO_SERVER_SSL_KEY_BASE64 }}
CARGO_SERVER_SSL_CA: ${{ secrets.SERVER_SSL_CA }}
CARGO_SERVER_SSL_CERT: ${{ secrets.SERVER_SSL_CERT }}
CARGO_SERVER_SSL_KEY: ${{ secrets.SERVER_SSL_KEY }}
run: bash dockerhub.sh ${{ github.event.inputs.version }}
4 changes: 4 additions & 0 deletions dockerhub.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,10 @@ if ! [[ "$PATCH" =~ ^[0-9]+$ ]]; then
exit 1
fi

CARGO_SERVER_SSL_CA_BASE64=$(echo "$CARGO_SERVER_SSL_CA" | base64)
CARGO_SERVER_SSL_CERT_BASE64=$(echo "$CARGO_SERVER_SSL_CERT" | base64)
CARGO_SERVER_SSL_KEY_BASE64=$(echo "$CARGO_SERVER_SSL_KEY" | base64)

# Validate if CARGO_SERVER_SSL_CA, CARGO_SERVER_SSL_CERT, and CARGO_SERVER_SSL_KEY are in base64 format
if ! [[ "$CARGO_SERVER_SSL_CA_BASE64" =~ ^[A-Za-z0-9+/=]+$ ]]; then
echo "Error: CARGO_SERVER_SSL_CA is not in base64 format."
Expand Down

0 comments on commit 613dc96

Please sign in to comment.