mirror of
https://github.com/p-stream/backend.git
synced 2026-04-18 17:32:05 +00:00
37 lines
1.1 KiB
YAML
37 lines
1.1 KiB
YAML
# .github/workflows/docker-publish.yml
|
|
name: Build and Publish Docker image to GHCR
|
|
|
|
on:
|
|
push:
|
|
branches: [ "master" ] # Change to your default branch
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: false
|
|
|
|
jobs:
|
|
build-and-push:
|
|
runs-on: ubuntu-latest
|
|
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
|
|
- name: Log in to GitHub Container Registry
|
|
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
|
|
with:
|
|
registry: ghcr.io
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Build Docker image
|
|
run: |
|
|
docker build -t ghcr.io/${{ github.repository_owner }}/backend:latest -t ghcr.io/${{ github.repository_owner }}/backend:${{ github.sha }} .
|
|
- name: Push Docker image
|
|
run: |
|
|
docker push ghcr.io/${{ github.repository_owner }}/backend:latest
|
|
docker push ghcr.io/${{ github.repository_owner }}/backend:${{ github.sha }}
|