Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Commit to docker only on tags #154

Merged
merged 1 commit into from
Feb 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: CI/CD Pipeline for Pull Requests to Master

'on':
pull_request:
branches:
Expand Down
23 changes: 9 additions & 14 deletions .github/workflows/push.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
name: CI/CD Pipeline for Push to Master
name: CI/CD Pipeline for Docker Tag Push

'on':
push:
branches:
- master
tags:
- 'v*'

jobs:
test:
runs-on: ubuntu-latest
Expand All @@ -22,17 +24,13 @@ jobs:
- name: Run tests
run: npm test
timeout-minutes: 1

docker:
needs: test
runs-on: ubuntu-latest
steps:
- name: Fetch latest wwebjs tag
id: fetch-wwebjs-tag
run: |
repo="pedroslopez/whatsapp-web.js"
latest_tag=$(curl -s "https://api.github.com/repos/$repo/tags" | jq -r .[0].name)
docker_friendly_tag=$(echo "$latest_tag" | tr '.-' '__')
echo "tag=$docker_friendly_tag" >> "$GITHUB_OUTPUT"
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
Expand All @@ -42,14 +40,11 @@ jobs:
with:
username: '${{ secrets.DOCKER_HUB_USERNAME }}'
password: '${{ secrets.DOCKER_HUB_TOKEN }}'
- name: Actual tag from fetch-tag job
run: |
echo "Tag from fetch-tag job: ${{ steps.fetch-wwebjs-tag.outputs.tag }}"
- name: Build and push with dynamic tag
uses: docker/build-push-action@v4
with:
platforms: linux/amd64,linux/arm64,linux/arm/v7
push: true
tags: |
chrishubert/whatsapp-web-api:${{ steps.fetch-wwebjs-tag.outputs.tag }}
chrishubert/whatsapp-web-api:${{ github.ref_name }}
chrishubert/whatsapp-web-api:latest
Loading