From 3f619b240778ac97c6d59230ae83dc034455e8b5 Mon Sep 17 00:00:00 2001 From: Anton Voylenko Date: Tue, 9 Dec 2025 19:46:21 +0200 Subject: [PATCH] ci: ability to install latest library --- .github/workflows/push.yml | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 9625d1f..425e84a 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -3,7 +3,8 @@ name: CI/CD Pipeline for Docker Tag Push on: push: tags: - - 'v*' + - "v*" + - "edge" jobs: test: @@ -15,10 +16,14 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v4 - - name: 'Use Node.js ${{ matrix.node-version }}' + - name: "Use Node.js ${{ matrix.node-version }}" uses: actions/setup-node@v4 with: - node-version: '${{ matrix.node-version }}' + node-version: "${{ matrix.node-version }}" + - name: Install edge version of whatsapp-web.js + if: github.ref_name == 'edge' + run: | + npm install --save-exact github:pedroslopez/whatsapp-web.js#main - name: Install dependencies run: npm ci - name: Run tests @@ -38,13 +43,23 @@ jobs: - name: Login to Docker Hub uses: docker/login-action@v2 with: - username: '${{ secrets.DOCKER_HUB_USERNAME }}' - password: '${{ secrets.DOCKER_HUB_TOKEN }}' + username: "${{ secrets.DOCKER_HUB_USERNAME }}" + password: "${{ secrets.DOCKER_HUB_TOKEN }}" + - name: Extract metadata + id: meta + run: | + if [[ "${{ github.ref_name }}" == "edge" ]]; then + echo "tags=avoylenko/wwebjs-api:edge" >> $GITHUB_OUTPUT + else + echo "tags=avoylenko/wwebjs-api:${{ github.ref_name }},avoylenko/wwebjs-api:latest" >> $GITHUB_OUTPUT + fi + - name: Install edge version of whatsapp-web.js + if: github.ref_name == 'edge' + run: | + sed -i 's|"whatsapp-web.js": "[^"]*"|"whatsapp-web.js": "github:pedroslopez/whatsapp-web.js#main"|' package.json - name: Build and push with dynamic tag uses: docker/build-push-action@v5 with: platforms: linux/amd64,linux/arm64,linux/arm/v7 push: true - tags: | - avoylenko/wwebjs-api:${{ github.ref_name }} - avoylenko/wwebjs-api:latest \ No newline at end of file + tags: ${{ steps.meta.outputs.tags }}