Skip to content

Commit 80c5200

Browse files
committed
chore(build): add test ci
1 parent bca5091 commit 80c5200

File tree

3 files changed

+32
-5
lines changed

3 files changed

+32
-5
lines changed

.github/workflows/tests.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: test
2+
on:
3+
pull_request:
4+
branches: ["main"]
5+
jobs:
6+
test:
7+
runs-on: ubuntu-latest
8+
permissions:
9+
packages: write
10+
steps:
11+
- name: checkout
12+
uses: actions/checkout@v4
13+
- name: test
14+
uses: "./"
15+
with:
16+
token: "${{ secrets.GITHUB_TOKEN }}"
17+
context: ./testdata
18+
file: ./testdata/Dockerfile

action.yml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
name: container-build-push
22
description: Simple github action that uses various docker actions to build and publish multiarch container images with meaningful tags.
33
inputs:
4+
context:
5+
description: "build's context is the set of files located in the specified path"
6+
default: "."
7+
file:
8+
description: "path to the Dockerfile (default ./Dockerfile)"
9+
default: "./Dockerfile"
410
checkout-deploy-key:
511
description: "checkout deploy key"
612
default: ""
@@ -10,7 +16,7 @@ inputs:
1016
required: true
1117
user:
1218
description: "container registry user"
13-
default: ${{ github.actor }}
19+
default: "${{ github.actor }}"
1420
required: true
1521
token:
1622
description: "container registry token"
@@ -50,16 +56,17 @@ runs:
5056
with:
5157
images: ${{ inputs.registry }}/${{ github.repository }}
5258
tags: |
53-
type=ref,event=branch
54-
type=sha,prefix=,format=short
59+
type=semver,pattern={{version}}
5560
type=edge,branch=main
5661
type=edge,branch=master
57-
type=semver,pattern={{version}}
62+
type=ref,event=branch
63+
type=sha,prefix=,format=short
5864
5965
- name: Build and push container image
6066
uses: docker/build-push-action@v4
6167
with:
62-
context: .
68+
context: ${{ inputs.context }}
69+
file: ${{ inputs.file }}
6370
push: true
6471
provenance: false # https://github.com/docker/build-push-action/issues/820
6572
tags: ${{ steps.meta.outputs.tags }}

testdata/Dockerfile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
FROM alpine
2+
RUN echo "test"

0 commit comments

Comments
 (0)