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: on:
push: push:
tags: tags:
- 'v*' - "v*"
- "edge"
jobs: jobs:
test: test:
@ -15,10 +16,14 @@ jobs:
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v4 uses: actions/checkout@v4
- name: 'Use Node.js ${{ matrix.node-version }}' - name: "Use Node.js ${{ matrix.node-version }}"
uses: actions/setup-node@v4 uses: actions/setup-node@v4
with: 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 - name: Install dependencies
run: npm ci run: npm ci
- name: Run tests - name: Run tests
@ -38,13 +43,23 @@ jobs:
- name: Login to Docker Hub - name: Login to Docker Hub
uses: docker/login-action@v2 uses: docker/login-action@v2
with: with:
username: '${{ secrets.DOCKER_HUB_USERNAME }}' username: "${{ secrets.DOCKER_HUB_USERNAME }}"
password: '${{ secrets.DOCKER_HUB_TOKEN }}' 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 - name: Build and push with dynamic tag
uses: docker/build-push-action@v5 uses: docker/build-push-action@v5
with: with:
platforms: linux/amd64,linux/arm64,linux/arm/v7 platforms: linux/amd64,linux/arm64,linux/arm/v7
push: true push: true
tags: | tags: ${{ steps.meta.outputs.tags }}
avoylenko/wwebjs-api:${{ github.ref_name }}
avoylenko/wwebjs-api:latest