ci: ability to install latest library

This commit is contained in:
Anton Voylenko 2025-12-09 19:46:21 +02:00
commit 3f619b2407

View file

@ -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
tags: ${{ steps.meta.outputs.tags }}