Skip to content

Commit

Permalink
Merge pull request #52 from bjw-s/master
Browse files Browse the repository at this point in the history
ci: Publish to GHCR, update actions
  • Loading branch information
mendhak committed Mar 16, 2023
2 parents 7af38b7 + 2e4e091 commit d7e8906
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 28 deletions.
40 changes: 27 additions & 13 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@

name: Build

# Controls when the action will run.
on:
# Controls when the action will run.
on:
push:
branches-ignore: "dependabot/**"
pull_request:
branches-ignore:
- "dependabot/**"
pull_request:
paths-ignore:
- '**.md'
workflow_dispatch:
Expand All @@ -21,13 +22,13 @@ jobs:
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Set up QEMU
uses: docker/setup-qemu-action@v1
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v2

- name: Inspect builder
run: |
Expand All @@ -37,22 +38,35 @@ jobs:
echo "Flags: ${{ steps.buildx.outputs.flags }}"
echo "Platforms: ${{ steps.buildx.outputs.platforms }}"
- name: Build the image multiplatform
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 .
- name: Docker metadata
id: meta
uses: docker/metadata-action@v4
with:
images: |
mendhak/http-https-echo
- name: Build the image multi-platform
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64/v8,linux/ppc64le,linux/s390x
push: false
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

- name: Build the image single platform and run tests
run: ./tests.sh

- name: Scan the image
id: scan
uses: anchore/scan-action@v2
uses: anchore/scan-action@v3
with:
image: "mendhak/http-https-echo:latest"
debug: false
acs-report-enable: true
severity-cutoff: critical

- name: upload Anchore scan SARIF report
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: ${{ steps.scan.outputs.sarif }}


40 changes: 25 additions & 15 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Set up QEMU
uses: docker/setup-qemu-action@v1
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
uses: docker/setup-buildx-action@v2

- name: Inspect builder
run: |
Expand All @@ -28,22 +28,32 @@ jobs:
echo "Flags: ${{ steps.buildx.outputs.flags }}"
echo "Platforms: ${{ steps.buildx.outputs.platforms }}"
- name: Build the image
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 .

- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::$(echo $GITHUB_REF | cut -d / -f 3)

- name: Log in to Docker Hub
uses: docker/login-action@v1
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_TOKEN }}

- name: Push to Docker Hub
uses: docker/build-push-action@v2
- name: Log in to GitHub Container registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Docker metadata
id: meta
uses: docker/metadata-action@v4
with:
images: |
mendhak/http-https-echo
ghcr.io/mendhak/http-https-echo
- name: Build and push image
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64/v8,linux/ppc64le,linux/s390x
push: true
tags: mendhak/http-https-echo:${{ steps.get_version.outputs.VERSION }}
platforms: linux/amd64,linux/arm/v6,linux/arm/v7,linux/arm64/v8,linux/ppc64le,linux/s390x
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

0 comments on commit d7e8906

Please sign in to comment.