34 lines
980 B
YAML
34 lines
980 B
YAML
1 name: Publish API to GitHub Container Registry
|
|
2
|
|
3 on:
|
|
4 push:
|
|
5 branches:
|
|
6 - main
|
|
7
|
|
8 jobs:
|
|
9 build-and-push-api:
|
|
10 runs-on: ubuntu-latest
|
|
11 permissions:
|
|
12 contents: read
|
|
13 packages: write
|
|
14
|
|
15 steps:
|
|
16 - name: Checkout code
|
|
17 uses: actions/checkout@v3
|
|
18
|
|
19 - name: Log in to GitHub Container Registry
|
|
20 uses: docker/login-action@v2
|
|
21 with:
|
|
22 registry: ghcr.io
|
|
23 username: ${{ github.actor }}
|
|
24 password: ${{ secrets.GITHUB_TOKEN }}
|
|
25
|
|
26 - name: Set up Docker Buildx
|
|
27 uses: docker/setup-buildx-action@v2
|
|
28
|
|
29 - name: Build and push Docker image
|
|
30 uses: docker/build-push-action@v4
|
|
31 with:
|
|
32 context: ./apps/api
|
|
33 push: true
|
|
34 tags: ghcr.io/${{ github.repository }}:latest,ghcr.io/${{ github.repository }}:main |