Skip to content

Commit 73209cb

Browse files
committed
Add build and push action
1 parent 23e027e commit 73209cb

File tree

1 file changed

+44
-0
lines changed

1 file changed

+44
-0
lines changed

.github/workflows/build_and_push.yml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Build and push to GHCR
2+
3+
on:
4+
push:
5+
branches:
6+
- deployment
7+
8+
concurrency:
9+
group: ${{ github.workflow }}-${{ github.ref }}
10+
cancel-in-progress: true
11+
12+
jobs:
13+
build-and-push:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Create a SHA tag
17+
id: sha_tag
18+
run: |
19+
tag=$(cut -c 1-7 <<< $GITHUB_SHA)
20+
echo "::set-output name=tag::$tag"
21+
22+
- name: Checkout code
23+
uses: actions/checkout@v3
24+
- name: Setup Docker BuildX
25+
uses: docker/setup-buildx-action@v2
26+
27+
- name: Login to GHCR
28+
uses: docker/login-action@v2
29+
with:
30+
registry: ghcr.io
31+
username: ${{ github.repository_owner }}
32+
password: ${{ github.token }}
33+
34+
- name: Build and push
35+
uses: docker/build-push-action@v3
36+
with:
37+
context: .
38+
file: ./Dockerfile
39+
push: true
40+
cache-from: type=repository,ref=ghcr.io/python-discord/logviewer:latest
41+
cache-to: type=inline
42+
tags: |
43+
ghcr.io/python-discord/logviewer:latest
44+
ghcr.io/python-discord/logviewer:${{ steps.sha_tag.outputs.tag }}

0 commit comments

Comments
 (0)