-
Notifications
You must be signed in to change notification settings - Fork 0
45 lines (39 loc) · 1.18 KB
/
server-image.yml
File metadata and controls
45 lines (39 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
name: Server Image
on:
push:
branches: [main, dev]
paths: [server/**, VERSION]
pull_request:
paths: [server/**, VERSION]
workflow_dispatch:
jobs:
build:
runs-on: blacksmith-4vcpu-ubuntu-2404
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup Blacksmith Builder
uses: useblacksmith/setup-docker-builder@v1
- uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Set image vars
run: |
echo "IMAGE=ghcr.io/${{ github.repository }}/api" >> "$GITHUB_ENV"
echo "VERSION=$(cat VERSION)" >> "$GITHUB_ENV"
- uses: useblacksmith/build-push-action@v2
with:
context: server
file: server/Dockerfile
push: ${{ github.event_name != 'pull_request' && github.ref == 'refs/heads/main' }}
build-args: |
VERSION=${{ env.VERSION }}+${{ github.sha }}
tags: |
${{ env.IMAGE }}:sha-${{ github.sha }}
${{ env.IMAGE }}:latest