-
Notifications
You must be signed in to change notification settings - Fork 36
55 lines (43 loc) · 1.64 KB
/
docker-image.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
name: Build and Push Multi-Platform Docker Image
on:
push:
branches:
- master # Trigger on pushes to the master branch
paths-ignore:
- 'build.txt' # Exclude build.txt from triggering the workflow
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout the repository
uses: actions/[email protected]
- name: Docker Setup QEMU
uses: docker/[email protected]
- name: Set up Docker Buildx
uses: docker/[email protected]
- name: Log in to Docker Hub
run: echo "${{ secrets.DOCKERHUB_TOKEN }}" | docker login -u "${{ secrets.DOCKERHUB_USERNAME }}" --password-stdin
- name: Build and push multi-platform Docker image
run: |
docker buildx build --platform linux/amd64,linux/arm64,linux/arm/v7 --push \
-t ${{ secrets.DOCKERHUB_USERNAME }}/slackonos:latest .
- name: Verify the platforms
run: docker buildx inspect --bootstrap
- name: Increment build number in build.txt
run: |
# Read the current build number
BUILD_NUMBER=$(cat build.txt)
# Increment the build number by 1
BUILD_NUMBER=$((BUILD_NUMBER + 1))
# Write the new build number back to build.txt
echo $BUILD_NUMBER > build.txt
- name: Commit and push updated build.txt
run: |
# Configure git
git config --local user.name "github-actions[bot]"
git config --local user.email "github-actions[bot]@users.noreply.github.com"
# Add build.txt
git add build.txt
git commit -m "Increment build number to $BUILD_NUMBER"
# Push changes
git push