Skip to content

Commit 3f619b2

Browse files
committed
ci: ability to install latest library
1 parent 78d027d commit 3f619b2

1 file changed

Lines changed: 23 additions & 8 deletions

File tree

.github/workflows/push.yml

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ name: CI/CD Pipeline for Docker Tag Push
33
on:
44
push:
55
tags:
6-
- 'v*'
6+
- "v*"
7+
- "edge"
78

89
jobs:
910
test:
@@ -15,10 +16,14 @@ jobs:
1516
steps:
1617
- name: Checkout repository
1718
uses: actions/checkout@v4
18-
- name: 'Use Node.js ${{ matrix.node-version }}'
19+
- name: "Use Node.js ${{ matrix.node-version }}"
1920
uses: actions/setup-node@v4
2021
with:
21-
node-version: '${{ matrix.node-version }}'
22+
node-version: "${{ matrix.node-version }}"
23+
- name: Install edge version of whatsapp-web.js
24+
if: github.ref_name == 'edge'
25+
run: |
26+
npm install --save-exact github:pedroslopez/whatsapp-web.js#main
2227
- name: Install dependencies
2328
run: npm ci
2429
- name: Run tests
@@ -38,13 +43,23 @@ jobs:
3843
- name: Login to Docker Hub
3944
uses: docker/login-action@v2
4045
with:
41-
username: '${{ secrets.DOCKER_HUB_USERNAME }}'
42-
password: '${{ secrets.DOCKER_HUB_TOKEN }}'
46+
username: "${{ secrets.DOCKER_HUB_USERNAME }}"
47+
password: "${{ secrets.DOCKER_HUB_TOKEN }}"
48+
- name: Extract metadata
49+
id: meta
50+
run: |
51+
if [[ "${{ github.ref_name }}" == "edge" ]]; then
52+
echo "tags=avoylenko/wwebjs-api:edge" >> $GITHUB_OUTPUT
53+
else
54+
echo "tags=avoylenko/wwebjs-api:${{ github.ref_name }},avoylenko/wwebjs-api:latest" >> $GITHUB_OUTPUT
55+
fi
56+
- name: Install edge version of whatsapp-web.js
57+
if: github.ref_name == 'edge'
58+
run: |
59+
sed -i 's|"whatsapp-web.js": "[^"]*"|"whatsapp-web.js": "github:pedroslopez/whatsapp-web.js#main"|' package.json
4360
- name: Build and push with dynamic tag
4461
uses: docker/build-push-action@v5
4562
with:
4663
platforms: linux/amd64,linux/arm64,linux/arm/v7
4764
push: true
48-
tags: |
49-
avoylenko/wwebjs-api:${{ github.ref_name }}
50-
avoylenko/wwebjs-api:latest
65+
tags: ${{ steps.meta.outputs.tags }}

0 commit comments

Comments
 (0)