|
| 1 | +name: Build and push multi-platform docker images |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - '^v[0-9]{2}\.[0-9]{2}(\.[0-9]{1,2})?$' |
| 7 | + workflow_dispatch: |
| 8 | + inputs: |
| 9 | + version: |
| 10 | + description: 'Release version' |
| 11 | + required: true |
| 12 | + |
| 13 | +jobs: |
| 14 | + build: |
| 15 | + runs-on: ubuntu-latest |
| 16 | + |
| 17 | + steps: |
| 18 | + - name: Checkout repository |
| 19 | + uses: actions/checkout@v3 |
| 20 | + |
| 21 | + - name: Setup Docker Buildx |
| 22 | + uses: docker/setup-buildx-action@v1 |
| 23 | + |
| 24 | + - name: Log in to Docker Hub |
| 25 | + uses: docker/login-action@v1 |
| 26 | + with: |
| 27 | + username: ${{ secrets.DOCKER_USERNAME }} |
| 28 | + password: ${{ secrets.DOCKER_PASSWORD }} |
| 29 | + |
| 30 | + - name: Cache Docker layers |
| 31 | + uses: actions/cache@v2 |
| 32 | + with: |
| 33 | + path: /tmp/.buildx-cache |
| 34 | + key: ${{ runner.os }}-buildx-${{ github.sha }} |
| 35 | + restore-keys: | |
| 36 | + ${{ runner.os }}-buildx- |
| 37 | +
|
| 38 | + - name: Build and push Docker image |
| 39 | + uses: docker/build-push-action@v2 |
| 40 | + with: |
| 41 | + context: . |
| 42 | + push: true |
| 43 | + platforms: linux/amd64,linux/arm64,linux/arm/v7 |
| 44 | + tags: | |
| 45 | + elementsproject/lightningd:${{ github.event.inputs.version }} |
| 46 | + # Commenting the next line to avoid replacing the latest tag with the testing image |
| 47 | + # I will uncomment it once the testing is done and images are ready for production |
| 48 | + # elementsproject/lightningd:latest |
| 49 | + cache-from: type=local,src=/tmp/.buildx-cache |
| 50 | + cache-to: type=local,dest=/tmp/.buildx-cache |
0 commit comments