Skip to content

Commit

Permalink
Add build and push action
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisLovering committed Aug 12, 2024
1 parent 23e027e commit 73209cb
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/build_and_push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Build and push to GHCR

on:
push:
branches:
- deployment

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
build-and-push:
runs-on: ubuntu-latest
steps:
- name: Create a SHA tag
id: sha_tag
run: |
tag=$(cut -c 1-7 <<< $GITHUB_SHA)
echo "::set-output name=tag::$tag"
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Docker BuildX
uses: docker/setup-buildx-action@v2

- name: Login to GHCR
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ github.token }}

- name: Build and push
uses: docker/build-push-action@v3
with:
context: .
file: ./Dockerfile
push: true
cache-from: type=repository,ref=ghcr.io/python-discord/logviewer:latest
cache-to: type=inline
tags: |
ghcr.io/python-discord/logviewer:latest
ghcr.io/python-discord/logviewer:${{ steps.sha_tag.outputs.tag }}

0 comments on commit 73209cb

Please sign in to comment.