This repository has been archived by the owner on Sep 22, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
56 lines (49 loc) · 1.82 KB
/
main.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
name: Build
on:
push:
paths:
- provision/*
- provision/*/*
- provision/*/*/*
- rootfs/*
- rootfs/*/*
- rootfs/*/*/*
- tests/*
- tests/*/*
- Dockerfile
- .github/workflows/main.yml
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Set versions
id: version
run: |
echo ::set-output name=docker_version::0.0.1
- name: Set tag var
id: vars
run: |
echo ::set-output name=docker_image::docker.io/cardboardci/psscriptanalyzer
echo ::set-output name=docker_tag::${{ steps.version.outputs.docker_version }}
echo ::set-output name=docker_tag_date::${{ steps.version.outputs.docker_version }}-$(date -u +'%Y%m%d')
- name: Build
run: |
docker build . \
--file Dockerfile \
--tag ${{ steps.vars.outputs.docker_image }}:${{ steps.vars.outputs.docker_tag }} \
--tag ${{ steps.vars.outputs.docker_image }}:${{ steps.vars.outputs.docker_tag_date }}
- name: Tests
uses: docker://gcr.io/gcp-runtimes/container-structure-test
with:
args: "test --config tests/tests.yaml --image ${{ steps.vars.outputs.docker_image }}:${{ steps.vars.outputs.docker_tag }}"
- name: Scan with Phonito Security
uses: phonito/phonito-scanner-action@master
with:
image: ${{ steps.vars.outputs.docker_image }}:${{ steps.vars.outputs.docker_tag_commit }}
phonito-token: ${{ secrets.PHONITO_TOKEN }}
- name: Deploy to DockerHub
if: github.ref == 'refs/heads/master'
run: |
echo ${{ secrets.DOCKERHUB_PASSWORD }} | docker login -u ${{ secrets.DOCKERHUB_USERNAME }} --password-stdin
docker push ${{ steps.vars.outputs.docker_image }}