Skip to content

Commit d7e8906

Browse files
authored
Merge pull request mendhak#52 from bjw-s/master
ci: Publish to GHCR, update actions
2 parents 7af38b7 + 2e4e091 commit d7e8906

2 files changed

Lines changed: 52 additions & 28 deletions

File tree

.github/workflows/build.yml

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22

33
name: Build
44

5-
# Controls when the action will run.
6-
on:
5+
# Controls when the action will run.
6+
on:
77
push:
8-
branches-ignore: "dependabot/**"
9-
pull_request:
8+
branches-ignore:
9+
- "dependabot/**"
10+
pull_request:
1011
paths-ignore:
1112
- '**.md'
1213
workflow_dispatch:
@@ -21,13 +22,13 @@ jobs:
2122
# Steps represent a sequence of tasks that will be executed as part of the job
2223
steps:
2324
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
24-
- uses: actions/checkout@v2
25+
- uses: actions/checkout@v3
2526

2627
- name: Set up QEMU
27-
uses: docker/setup-qemu-action@v1
28+
uses: docker/setup-qemu-action@v2
2829
- name: Set up Docker Buildx
2930
id: buildx
30-
uses: docker/setup-buildx-action@v1
31+
uses: docker/setup-buildx-action@v2
3132

3233
- name: Inspect builder
3334
run: |
@@ -37,22 +38,35 @@ jobs:
3738
echo "Flags: ${{ steps.buildx.outputs.flags }}"
3839
echo "Platforms: ${{ steps.buildx.outputs.platforms }}"
3940
40-
- name: Build the image multiplatform
41-
run: docker buildx build --output "type=image,push=false" --platform linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64/v8,linux/ppc64le,linux/s390x --tag mendhak/http-https-echo:latest --file ./Dockerfile .
41+
- name: Docker metadata
42+
id: meta
43+
uses: docker/metadata-action@v4
44+
with:
45+
images: |
46+
mendhak/http-https-echo
47+
48+
- name: Build the image multi-platform
49+
uses: docker/build-push-action@v4
50+
with:
51+
context: .
52+
platforms: linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64/v8,linux/ppc64le,linux/s390x
53+
push: false
54+
tags: ${{ steps.meta.outputs.tags }}
55+
labels: ${{ steps.meta.outputs.labels }}
4256

4357
- name: Build the image single platform and run tests
4458
run: ./tests.sh
45-
59+
4660
- name: Scan the image
4761
id: scan
48-
uses: anchore/scan-action@v2
62+
uses: anchore/scan-action@v3
4963
with:
5064
image: "mendhak/http-https-echo:latest"
5165
debug: false
5266
acs-report-enable: true
67+
severity-cutoff: critical
68+
5369
- name: upload Anchore scan SARIF report
5470
uses: github/codeql-action/upload-sarif@v2
5571
with:
5672
sarif_file: ${{ steps.scan.outputs.sarif }}
57-
58-

.github/workflows/publish.yml

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@ jobs:
1111
publish:
1212
runs-on: ubuntu-latest
1313
steps:
14-
- uses: actions/checkout@v2
14+
- uses: actions/checkout@v3
1515

1616
- name: Set up QEMU
17-
uses: docker/setup-qemu-action@v1
17+
uses: docker/setup-qemu-action@v2
1818

1919
- name: Set up Docker Buildx
2020
id: buildx
21-
uses: docker/setup-buildx-action@v1
21+
uses: docker/setup-buildx-action@v2
2222

2323
- name: Inspect builder
2424
run: |
@@ -28,22 +28,32 @@ jobs:
2828
echo "Flags: ${{ steps.buildx.outputs.flags }}"
2929
echo "Platforms: ${{ steps.buildx.outputs.platforms }}"
3030
31-
- name: Build the image
32-
run: docker buildx build --output "type=image,push=false" --platform linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64/v8,linux/ppc64le,linux/s390x --tag mendhak/http-https-echo:latest --file ./Dockerfile .
33-
34-
- name: Get the version
35-
id: get_version
36-
run: echo ::set-output name=VERSION::$(echo $GITHUB_REF | cut -d / -f 3)
37-
3831
- name: Log in to Docker Hub
39-
uses: docker/login-action@v1
32+
uses: docker/login-action@v2
4033
with:
4134
username: ${{ secrets.DOCKER_HUB_USERNAME }}
4235
password: ${{ secrets.DOCKER_HUB_TOKEN }}
4336

44-
- name: Push to Docker Hub
45-
uses: docker/build-push-action@v2
37+
- name: Log in to GitHub Container registry
38+
uses: docker/login-action@v2
39+
with:
40+
registry: ghcr.io
41+
username: ${{ github.actor }}
42+
password: ${{ secrets.GITHUB_TOKEN }}
43+
44+
- name: Docker metadata
45+
id: meta
46+
uses: docker/metadata-action@v4
47+
with:
48+
images: |
49+
mendhak/http-https-echo
50+
ghcr.io/mendhak/http-https-echo
51+
52+
- name: Build and push image
53+
uses: docker/build-push-action@v4
4654
with:
55+
context: .
56+
platforms: linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64/v8,linux/ppc64le,linux/s390x
4757
push: true
48-
tags: mendhak/http-https-echo:${{ steps.get_version.outputs.VERSION }}
49-
platforms: linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64/v8,linux/ppc64le,linux/s390x
58+
tags: ${{ steps.meta.outputs.tags }}
59+
labels: ${{ steps.meta.outputs.labels }}

0 commit comments

Comments
 (0)