Skip to content

chore(deps): update docker/setup-buildx-action action to v3 #404

chore(deps): update docker/setup-buildx-action action to v3

chore(deps): update docker/setup-buildx-action action to v3 #404

Workflow file for this run

name: CICD
on:
pull_request:
branches:
- master
push:
branches: []
tags: 'v*'
paths:
- 'src/**/*'
- 'test/**/*'
- '.github/action/**/*'
- '.github/workflows/**/*'
- 'package*.json'
- 'tsconfig*.json'
- 'yarn.lock'
- 'Dockerfile'
- '.dockerignore'
- 'docker-entrypoint.sh'
- 'goss*.yaml'
jobs:
lint:
runs-on: ubuntu-22.04
steps:
- run: git config --global core.autocrlf false
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
check-latest: true
node-version: '16.x'
- uses: bahmutov/npm-install@v1
- run: echo yarn lint # disable for now
build:
runs-on: ubuntu-22.04
steps:
- run: git config --global core.autocrlf false
- uses: actions/checkout@v4
- uses: actions/cache@v3
id: cache
with:
path: dist/
key:
${{ runner.os }}-src-${{ hashFiles('src/**', '**/package*.json',
'**/*.lock', 'tsconfig.json') }}
- if: ${{ steps.cache.outputs.cache-hit != 'true'}}
uses: actions/setup-node@v3
with:
check-latest: true
node-version: '16.x'
- if: ${{ steps.cache.outputs.cache-hit != 'true'}}
uses: bahmutov/npm-install@v1
- if: ${{ steps.cache.outputs.cache-hit != 'true'}}
run: yarn build
- run: |
tar -cvf dist.tar dist/
tar -cvf dist.prod.tar dist/index.js dist/*.production.*.js
- uses: actions/upload-artifact@v3
with:
name: dist.prod
path: dist.prod.tar
retention-days: 7
- uses: actions/upload-artifact@v3
with:
name: dist
path: dist.tar
retention-days: 7
test:
runs-on: ubuntu-22.04
steps:
- run: git config --global core.autocrlf false
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
check-latest: true
node-version: '16.x'
- uses: bahmutov/npm-install@v1
- run: yarn test --ci --coverage --maxWorkers=2
- uses: codecov/codecov-action@v3
if: ${{ success() }}
continue-on-error: true
docker:
runs-on: ubuntu-22.04
permissions:
pull-requests: write
outputs:
config: ${{ steps.generate.outputs.config }}
builds: ${{ steps.generate.outputs.builds }}
manifests: ${{ steps.generate.outputs.manifests }}
steps:
- run: git config --global core.autocrlf false
- uses: actions/checkout@v4
- id: generate
uses: ./.github/actions/docker/buildConfig
with:
repositories: |
ghcr.io/hertzg/tesseract-server
hertzg/tesseract-server
platforms: |
linux/amd64
linux/arm64/v8
linux/arm/v7
linux/arm/v6
linux/ppc64le
linux/s390x
- uses: jwalton/gh-find-current-pr@v1
if: ${{ github.event_name != 'pull_request' }}
id: find-pr
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- uses: marocchino/sticky-pull-request-comment@v2
if: ${{ github.event_name != 'pull_request' }}
with:
number: ${{ steps.find-pr.outputs.pr }}
message: |
# Docker build request
```json
${{ toJSON(fromJSON(steps.generate.outputs.config)) }}
```
Images are being built, please wait a few minutes before they get published. They will appear in this comment as soon as they are ready. You can follow the process by inspecting the running checks.
docker-build:
needs:
- docker
- build
runs-on: ubuntu-22.04
permissions:
packages: read
strategy:
matrix: ${{ fromJSON(needs.docker.outputs.builds) }}
fail-fast: false
steps:
- uses: docker/setup-qemu-action@v2
- uses: docker/setup-buildx-action@v3
- uses: docker/login-action@v3
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'hertzg/rtl_433_docker' }}
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: docker/login-action@v3
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'hertzg/rtl_433_docker' }}
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/cache@v3
with:
path: /tmp/.buildx-cache
key:
${{ runner.os }}-buildx-v2-${{ matrix.platform }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-v2-${{ matrix.platform }}
${{ runner.os }}-buildx-v2-
# Build the container
- uses: actions/checkout@v4
- uses: actions/download-artifact@v3
id: download
with:
name: dist.prod
path: ./
- run: |
tar xf dist.prod.tar
rm dist.prod.tar
- name: Build
uses: docker/build-push-action@v5
with:
context: .
file: ./Dockerfile
build-args: |
DIST_SRC=./dist
target: prod_copy_dist
platforms: ${{ matrix.platform }}
load: true
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache
tags: ${{ matrix.tag }}
- uses: ishworkh/docker-image-artifact-upload@v1
with:
image: ${{ matrix.tag }}
docker-test:
needs:
- docker
- docker-build
runs-on: ubuntu-22.04
strategy:
matrix: ${{ fromJSON(needs.docker.outputs.builds) }}
fail-fast: false
steps:
- uses: docker/setup-qemu-action@v2
- uses: ishworkh/docker-image-artifact-download@v1
with:
image: ${{ matrix.tag }}
# Test that container is working
- uses: e1himself/goss-installation-action@v1.1.0
with:
version: v0.3.16
- uses: actions/checkout@v4
- run: dgoss run ${{ matrix.tag }}
docker-dive:
needs:
- docker
- docker-build
runs-on: ubuntu-22.04
strategy:
matrix: ${{ fromJSON(needs.docker.outputs.builds) }}
fail-fast: false
steps:
- uses: ishworkh/docker-image-artifact-download@v1
with:
image: ${{ matrix.tag }}
- uses: yuichielectric/dive-action@0.0.4
with:
image: ${{ matrix.tag }}
github-token: ${{ secrets.GITHUB_TOKEN }}
docker-push:
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'hertzg/rtl_433_docker' }}
needs:
- test
- docker
- docker-test
runs-on: ubuntu-22.04
permissions:
packages: write
strategy:
matrix: ${{ fromJSON(needs.docker.outputs.builds) }}
fail-fast: false
steps:
- uses: docker/setup-buildx-action@v3
- uses: ishworkh/docker-image-artifact-download@v1
with:
image: ${{ matrix.tag }}
- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- env:
LOCAL_NAME: ${{ matrix.tag }}
PUSH_NAMES: ${{ join(matrix.push, ' ') }}
run: |
for PUSH_NAME in $PUSH_NAMES; do
docker tag $LOCAL_NAME $PUSH_NAME
docker push $PUSH_NAME
done;
docker-multiarch:
needs:
- docker
- docker-push
runs-on: ubuntu-22.04
permissions:
pull-requests: write
packages: write
strategy:
matrix: ${{ fromJSON(needs.docker.outputs.manifests) }}
fail-fast: false
steps:
- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- env:
DOCKER_CLI_EXPERIMENTAL: enabled
run: |
docker manifest create ${{ matrix.name }} ${{ join(matrix.images, ' ') }}
docker manifest push ${{ matrix.name }}
- uses: jwalton/gh-find-current-pr@v1
if: ${{ github.event_name != 'pull_request' }}
id: find-pr
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- uses: marocchino/sticky-pull-request-comment@v2
if: ${{ github.event_name != 'pull_request' }}
with:
number: ${{ steps.find-pr.outputs.pr }}
append: true
message: |
## Published `${{ matrix.name }}`
```json
${{ toJSON(matrix) }}
```