From 9e472f89624727e0330ac44a5ce8a95cdcfa4b44 Mon Sep 17 00:00:00 2001 From: Ariel Gentile Date: Tue, 10 Sep 2024 11:38:39 -0300 Subject: [PATCH] ci: add stable release script Signed-off-by: Ariel Gentile --- .github/workflows/stable-release.yml | 50 ++++++++++++++++++++++++++++ README.md | 8 ++--- 2 files changed, 54 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/stable-release.yml diff --git a/.github/workflows/stable-release.yml b/.github/workflows/stable-release.yml new file mode 100644 index 0000000..a06c47e --- /dev/null +++ b/.github/workflows/stable-release.yml @@ -0,0 +1,50 @@ +name: Stable release +on: + push: + tags: + - "*" +env: + DH_USERNAME: ${{secrets.DOCKER_HUB_LOGIN}} + DH_TOKEN: ${{secrets.DOCKER_HUB_PWD}} + IMAGE_NAME: 'webrtc-server' +jobs: + build-and-push: + name: Build and push docker images + runs-on: ubuntu-latest + + steps: + - name: Checkout webrtc-server + uses: actions/checkout@v4 + + - name: Setup node v20 + uses: actions/setup-node@v4 + with: + node-version: 20 + + - id: get_version + uses: battila7/get-version-action@v2 + + - name: Install dependencies + run: | + npm install + - name: Log in to Docker Hub + if: steps.get_version.outputs.is-semver == 'true' + run: | + echo "$DH_TOKEN" | docker login -u "$DH_USERNAME" --password-stdin + + - name: Build Docker image + if: steps.get_version.outputs.is-semver == 'true' + run: | + docker build -f Dockerfile -t $DH_USERNAME/$IMAGE_NAME:${{steps.get_version.outputs.version}} . + + - name: Add tags to Docker image and push to Docker Hub + if: steps.get_version.outputs.is-semver == 'true' + run: | + docker tag $DH_USERNAME/$IMAGE_NAME:${{steps.get_version.outputs.version}} $DH_USERNAME/$IMAGE_NAME:v${{steps.get_version.outputs.major}} + docker tag $DH_USERNAME/$IMAGE_NAME:${{steps.get_version.outputs.version}} $DH_USERNAME/$IMAGE_NAME:v${{steps.get_version.outputs.major}}.${{steps.get_version.outputs.minor}} + docker tag $DH_USERNAME/$IMAGE_NAME:${{steps.get_version.outputs.version}} $DH_USERNAME/$IMAGE_NAME:v${{steps.get_version.outputs.major}}.${{steps.get_version.outputs.minor}}.${{steps.get_version.outputs.patch}} + docker tag $DH_USERNAME/$IMAGE_NAME:${{steps.get_version.outputs.version}} $DH_USERNAME/$IMAGE_NAME:v${{steps.get_version.outputs.version-without-v}} + docker push $DH_USERNAME/$IMAGE_NAME:v${{steps.get_version.outputs.major}} + docker push $DH_USERNAME/$IMAGE_NAME:v${{steps.get_version.outputs.major}}.${{steps.get_version.outputs.minor}} + docker push $DH_USERNAME/$IMAGE_NAME:v${{steps.get_version.outputs.major}}.${{steps.get_version.outputs.minor}}.${{steps.get_version.outputs.patch}} + docker push $DH_USERNAME/$IMAGE_NAME:${{steps.get_version.outputs.version}} \ No newline at end of file diff --git a/README.md b/README.md index c37b4f8..2b3b7de 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # WebRTC Server with Mediasoup, Docker, Kubernetes and Turn Server -This application, based on [Mediasoup-demo v3](https://github.com/versatica/mediasoup-demo/tree/v3), has been extensively modified and customized for the 2060 project to include a TURN server, specifically Coturn. +This application, based on [Mediasoup-demo v3](https://github.com/versatica/mediasoup-demo/tree/v3), has been extensively modified and customized for 2060 to include a TURN server, specifically Coturn. -You can deploy the demo using Docker or Kubernetes, with integration of the [Coturn](https://github.com/coturn/coturn) server for TURN functionality. +You can deploy it using Docker or Kubernetes, with integration of the [Coturn](https://github.com/coturn/coturn) server for TURN functionality. ## Table of Contents @@ -91,9 +91,9 @@ docker build . -t 2060-webrtc-server:test Should the start.sh script fail to detect the container's IP address, you may modify the Dockerfile by replacing CMD ["sh", "/service/start.sh"] with CMD ["node", "/service/server.js"]. Subsequently, manually set the MEDIASOUP_ANNOUNCED_IP variable. -You are required to generate the certificates private-key.pem and public-certificate.pem and store them in a directory accessible to the application. While the default directory is certificates, you have the flexibility to specify an alternative directory name by configuring the HTTPS_CERTIFICATES_PATH environment variable. +You are required to generate a certificate and place both its public and private part in PEM format in a directory reachable by the application. The full path must be set on `HTTPS_CERT_FULLCHAIN` and `HTTPS_CERT_PRIVKEY` environment variable respectively. -Certificates can be created using OpenSSL with the execution of the following commands: +Certificate can be created using OpenSSL with the execution of the following commands: ```bash openssl genpkey -algorithm RSA -out privkey.pem