This repository has been archived by the owner on Aug 28, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (55 loc) · 1.68 KB
/
build.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
56
57
58
name: Build Application Image
on:
push:
branches:
- "**"
env:
IMAGE: "ghcr.io/${{ github.repository }}"
jobs:
build-image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: docker/setup-buildx-action@v1
- name: Generate branch Docker Image attributes
id: meta
uses: crazy-max/ghaction-docker-meta@v2
with:
images: "${{ env.IMAGE }}"
tags: |
type=ref,event=branch
type=sha
- name: Build Docker Image
id: build
uses: docker/build-push-action@v2
with:
load: true
tags: "${{ steps.meta.outputs.tags }}"
labels: "${{ steps.meta.outputs.labels }}"
- name: Save Docker Image archive to local filesystem
run: "docker save --output app.tar ${{ env.IMAGE }}"
- name: Upload application's Docker Image as pipeline artifact
uses: actions/upload-artifact@v2
with:
path: app.tar
name: app.tar
- name: "Re-run failed build to `test` stage"
if: failure()
uses: docker/build-push-action@v2
with:
target: test
load: true
tags: "${{ steps.meta.outputs.tags }}"
- name: Extract test reports from Docker Image
if: always()
uses: shrink/actions-docker-extract@v1
id: reports
with:
image: "${{ env.IMAGE }}:${{ steps.meta.outputs.version }}"
path: /srv/reports/.
- name: Upload test report(s) as pipeline artifacts
if: always()
uses: actions/upload-artifact@v2
with:
path: "${{ steps.reports.outputs.destination }}"
name: test-reports