Skip to content

Commit 23a6550

Browse files
authored
Create build.yaml
1 parent 7157c6f commit 23a6550

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

.github/workflows/build.yaml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: build
2+
3+
4+
on:
5+
push:
6+
branches: [ master ]
7+
pull_request:
8+
branches: [ master ]
9+
10+
11+
env:
12+
ACCOUNT: ${{ github.repository_owner }}
13+
REPOSITORY: ${{ github.event.repository.name }}
14+
15+
16+
jobs:
17+
18+
build:
19+
runs-on: ubuntu-latest
20+
container: docker:git
21+
permissions:
22+
contents: read
23+
packages: write
24+
steps:
25+
- uses: actions/checkout@v3
26+
- name: resolve paths-filter error
27+
run: git config --global --add safe.directory /__w/${REPOSITORY}/${REPOSITORY}
28+
- name: detect build file changes
29+
uses: dorny/paths-filter@v2
30+
id: filter
31+
with:
32+
filters: |
33+
buildfiles:
34+
- Dockerfile
35+
- requirements.txt
36+
- tests/requirements-test.txt
37+
- name: build & push image to registry
38+
if: steps.filter.outputs.buildfiles == 'true'
39+
run: |
40+
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u $ACCOUNT --password-stdin
41+
docker build -t ghcr.io/${ACCOUNT}/${REPOSITORY} .
42+
docker push ghcr.io/${ACCOUNT}/${REPOSITORY}

0 commit comments

Comments
 (0)